#1522 (story titles sometimes run long)

This commit is contained in:
David Sinclair 2021-08-20 21:45:09 -07:00
parent 37552d1f5c
commit c592b05fb4
2 changed files with 9 additions and 1 deletions

View file

@ -1810,6 +1810,8 @@ heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (content.length < 50 && [story[@"story_title"] length] < 30) {
return height + font.pointSize * 3;
} else if (content.length < 50 && [story[@"story_title"] length] >= 30) {
return height + font.pointSize * 5;
} else if (content.length < 100) {
return height + font.pointSize * 5;
} else if (self.textSize == FeedDetailTextSizeMedium) {

View file

@ -321,8 +321,9 @@ static UIFont *indicatorFont = nil;
}
CGFloat boundingRows = cell.isShort ? 1.5 : 3;
if (!cell.isShort && (self.cell.textSize == FeedDetailTextSizeMedium || self.cell.textSize == FeedDetailTextSizeLong)) {
boundingRows = ((r.size.height - 24) / font.pointSize) - 2;
boundingRows = MIN(((r.size.height - 24) / font.pointSize) - 2, 4);
}
cell.storyTitle = [NSString stringWithFormat:@"%@ %@", @(boundingRows), cell.storyTitle];
CGSize theSize = [cell.storyTitle
boundingRectWithSize:CGSizeMake(rect.size.width, font.pointSize * boundingRows)
options:NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesLineFragmentOrigin
@ -355,6 +356,8 @@ static UIFont *indicatorFont = nil;
NSParagraphStyleAttributeName: paragraphStyle}
context:nil];
// CGContextStrokeRect(context, storyTitleFrame);
if (cell.storyContent) {
int storyContentWidth = rect.size.width;
CGFloat boundingRows = cell.isShort ? 1.5 : 3;
@ -398,6 +401,9 @@ static UIFont *indicatorFont = nil;
NSForegroundColorAttributeName: textColor,
NSParagraphStyleAttributeName: paragraphStyle}
context:nil];
// CGContextStrokeRect(context, CGRectMake(storyTitleX, storyContentY,
// rect.size.width - storyTitleX + leftMargin, contentSize.height));
}
// story date