I have a table cell that have two pieces of information, one is the article title and is other is the preview of the article. However, the title size changes and may have 1 - 3 lines, so I have to resize the frame of the preview every time.
I want to the make the cell display the maximum number of lines that it can display based on the preview's height and show ... at the end if the information is not completely shown.
I tried:
cell.previewLabel.text = @"Some data here";
cell.previewLabel.textColor = [UIColor lightGrayColor];
cell.previewLabel.frame = CGRectMake(50, 20, 200, 95 - cell.titleLabel.frame.size.height - 5)
[cell.previewLabel sizeToFit];
but it seems to display only 1 lines of information.
When I add
cell.previewLabel.numberOfLines = 0;
The label now have too many lines ( the height of the label is longer than the maximum height I initialized earlier.
How can I fix it?