Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How control line-spacing of UILabels?

I'm using CustomCell instead of UITableViewCell on UITableView.

I put two UILables on CustomCell.

Refered this site: here , but I failed...

Question : How can I control line spacing of UILabels?

like image 357
hyekyung Avatar asked Dec 12 '22 07:12

hyekyung


1 Answers

Starting from iOS 6 you can set an attributed string to the UILabel. Check the following :

NSMutableParagraphStyle *paragrahStyle = [[NSMutableParagraphStyle alloc] init];
[paragrahStyle setLineSpacing:40];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragrahStyle range:NSMakeRange(0, [labelText length])];

cell.label.attributedText = attributedString;
like image 166
iosMentalist Avatar answered Jan 02 '23 17:01

iosMentalist