Reputation: 580
I have a UILabel
with 4 lines in a UICollectionView
. When there are fewer than 4 rows, I want the text to be on the top and not in the centre.
Thanks..
Upvotes: 4
Views: 7926
Reputation: 982
In Swift:
yourLabel.lineBreakMode = NSLineBreakMode.ByClipping
yourLabel.text = yourString.stringByAppendingString("\n\n\n\n")
Upvotes: 1
Reputation: 3850
this is the solution
dispatch_async(dispatch_get_main_queue(), ^{
yourLabel.numberOfLines = 0;
[yourLabel sizeToFit];
});
Upvotes: 4