CGFloat Heih = 20; NSString * clabelstring = @ "This is the text of the test Uilabel line spacing. This is the text that tests the Uilabel line spacing. n This is the text that tests the Uilabel line spacing. n This is the text that tests the Uilabel line spacing. This is the text that tests the Uilabel line spacing. This is the text that tests the Uilabel line spacing. This is the text that tests the Uilabel line spacing. "; UILabel * CLabel = [[UILabel alloc]initwithframe:cgrectmake (Heih, 280, max)];clabel.numberoflines = 0;clabel.font = [U IFont fontwithname:fontname size:16];clabel.textcolor = [Uicolor Graycolor]; nsmutableattributedstring * attributedString1 = [[Nsmutableattributedstring alloc] initwithstring:clabelstring]; Nsmutableparagraphstyle * ParagraphStyle1 = [[Nsmutableparagraphstyle alloc] init]; [ParagraphStyle1 Setlinespacing:8]; [AttributedString1 addattribute:nsparagraphstyleattributename Value:paragraphstyle1 range:nsmakerange (0, [ Clabelstring length]); [CLabel setattributedtext:attributedstring1]; [CLabel SizeToFit]; [Self.view Addsubview:clabel];
iOS development adjusts line spacing for Uilabel