objective c - As of iOS 10.3: UIButton ignoring negative paragraph lineSpacing in NSAttributedString -
i have uibutton 2 words, wrapped 2 lines (i set lines value "2" in code later). have been tightening default linespacing putting in negative value paragraph linespacing (as simplified & shown below).
as of ios 10.3, appears negative value being ignored. while can increase linespacing positive value, can not tighten 2 lines anymore.
does else know how tighten in uibutton? (i'm ready change control up... thought i'd post question).
much all.
nsmutableparagraphstyle *paragraphstyle = [[nsmutableparagraphstyle alloc] init]; paragraphstyle.linespacing = -15.0f; paragraphstyle.alignment = nstextalignmentleft; nsdictionary * attributes = [nsdictionary dictionarywithobjectsandkeys: [uicolor whitecolor], nsstrokecolorattributename, [uicolor greencolor], nsforegroundcolorattributename, @(-2.0), nsstrokewidthattributename, paragraphstyle, nsparagraphstyleattributename, nil]; nsmutableattributedstring *buttontitle = [[nsmutableattributedstring alloc] initwithstring:str attributes:attributes]; self.thebutton.titlelabel.numberoflines = 2; [self.thebutton setattributedtitle:buttontitle forstate:uicontrolstatenormal];
edit: looks issue uilabel also.
Comments
Post a Comment