swift - Adding NSMutableParagraphStyle lineSpacing cause text to not fit UILabel -


i have created normal uilabel , want able add line spacing text uilabel.

although when affects adjustsfontsizetofitwidth , no longer fitted uilabel.

some code have used:

        var userquestionsanswer = uilabel(frame: cgrectmake(0, 0, 20, 20))         userquestionsanswer.font = uifont(name: font.gothamblack, size: 15)         userquestionsanswer.numberoflines = 0         userquestionsanswer.adjustsfontsizetofitwidth = true          var style = nsmutableparagraphstyle()         style.linespacing = view.frame.size.height * 0.021         style.alignment = nstextalignment.center         let attributes = [nsparagraphstyleattributename : style]         var answertext = "this answer"          self.userquestionsanswer.attributedtext = nsattributedstring(string: answertext!, attributes:attributes) 

can tell why , how around it?

remove nsmutableparagraphstyle , work. don't know why attribute cause of breaking text font size adjustment.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -