swift - NSBackgroundColorAttributeName doesn't seem to work on iOS 10.3 -


we display label in our apps contains attributed text , highlighting color. achieve this, use following code used work:

let paddedlineattributed = nsmutableattributedstring(string: paddedline, attributes: [nsfontattributename : newfont, nsparagraphstyleattributename : paragraphstyle, nsbackgroundcolorattributename : color]) 

but after upgrading 1 of our test devices ios 10.3, specified background color label not taking effect anymore. instead, using transparent background color making label invisible using white text color same color parent view.

i suspect nsbackgroundcolorattributename culprit official api reference remains unchanged - https://developer.apple.com/reference/appkit/nsbackgroundcolorattributename

any ideas?

copied @schystz comment:

adding nsbaselineoffsetattributename: 0 resolves issue.

let paddedlineattributed = nsmutableattributedstring(string: paddedline, attributes: [nsfontattributename : newfont, nsparagraphstyleattributename : paragraphstyle, nsbackgroundcolorattributename : color, nsbaselineoffsetattributename: 0]) 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -