It appears to only happen if the line word-wraps onto the next line, but if I do something like a list where there's no word wrap, it displays the height properly (e.g.:
@"1<br/><br/>
2<br/><br/>
...
200"
That will display every line but this will cut off the line:
@"SUPER LONG LINE WITH A LOT OF TEXT and WRAPS TO THE NEXT LINE<br/><br/>
...
LAST LINE WONT BE VISIBLE BECAUSE THE HEIGHT IS OFF"
////// Here is where I am loading the cell height (if i adjust the height here, I can view the rest of the content): //////Class with the table//////
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [self populateCell:tableView indexPath:indexPath];
[cell setNeedsDisplay];
[cell layoutIfNeeded];
[cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height
//////Custom Cell class////
for (NSString *item in arrayOfRandomText) {
NSString *newItem = [item stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[myAppendedStr appendString:[NSString stringWithFormat:@"%@<br/><br/>", newItem]];
}
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithData:[myAppendedStr dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
[attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,attrStr.length)];
[attrStr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Helvetica Neue" size:14.0] range:NSMakeRange(0, attrStr.length)];
self.myTxtView.attributedText = attrStr;