I have searched around for any tip for my problem. But I cannot find a solution for this.
I have made a subclass of UITableviewCell (FeedCell). With one image and t
Try putting the code that sets number of lines, linebreakmode, and font OUTSIDE of those curly braces
I know this is an old post, but it came up when I was searching.
I got an example like this by following http://www.raywenderlich.com/73602/dynamic-table-view-cell-height-auto-layout.
I think for iOS8 the following is required:
try
[tweetCell.tweetText sizeToFit]
Firstly, if you want to show 2 line of text (minimum 1 and maximum 2), the numberOfLines
must be set to 2. Setting it to 0 means no limit.
Secondly, setting just the number of lines is not enough. The label width HAS to be specified. Either use sizeToFit
, or set a constant value.
For mutiline use the following:
tweetCell.tweetText.numberOfLines = 0;
[tweetCell.tweetText sizeToFit];
for testing purpose set the height of row as 46.0f in the following method:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
I could not get the height issue fixed but this did give me a UILabel with multiple lines