ios - Underlining glitch -


i'm trying add underlining attributed text using custom font (helveticarounded-bold). yet, underlining glitches both on simulator , device. this:

enter image description here

this uilabel can reproduce problem in uitextview. appears if text renderer miscalculating draw underline, on lines.

the bare-bones code:

- (void)viewdidload {   [super viewdidload];   uifont *font = [uifont fontwithname:@"helveticarounded-bold" size:18];   self.label.font = font;   self.label.numberoflines = 0;   nsdictionary *attributes = @{ nsunderlinestyleattributename : @(nsunderlinestylesingle) };   self.label.attributedtext = [[nsattributedstring alloc] initwithstring:@"this test. , test has failed. did deserve this? why nsunderlinestyleattributename? why?"                                                               attributes:attributes]; } 

fun fact: underlining not glitch @ size 24 or above (!). not repro using tttattributedlabel.

any idea might going on here?

it appears glitch on non-retina devices when using nsunderlinestylethick. switching nsunderlinestylesingle seems fix issue. can set conditional non-retina devices use nsunderlinestylesingle if want keep nsunderlinestylethick on other devices.

edit: realized you're using nsunderlinestylesingle in sample code :/ in code, worked given font/size, system font. fixed issue on end. seems fix may not universal worked in case.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -