I found your question because I also fought with NSAttributedString. For me, the beginEditing and endEditing did the trick, as indicated in Changing the attribute string . In addition, lineSpacing is set using setLineSpacing in Style.
So you can try changing the code:
NSString *string = @" Hello \n world"; attrString = [[NSMutableAttributedString alloc] initWithString:string]; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy]; [paragraphStyle setLineSpacing:20]
I have not tested this exact code, although, by the way, but mine looks almost the same.
EDIT:
Meanwhile, I tested it, and correct me if I am mistaken, the calls - beginEditing and - endEditing seem quite important.
Jan Nash Apr 28 '15 at 11:38 2015-04-28 11:38
source share