From 4eca8f227ae8b0822860feffd657af934d526c1b Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Sat, 16 Aug 2025 18:56:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Enable=20trunction=20with=20NSMu?= =?UTF-8?q?tableParagraphStyle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/MainTimeline/Modern Cells/MainTimelineFeedCell.swift | 4 +++- iOS/MainTimeline/Modern Cells/MainTimelineIconFeedCell.swift | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/iOS/MainTimeline/Modern Cells/MainTimelineFeedCell.swift b/iOS/MainTimeline/Modern Cells/MainTimelineFeedCell.swift index e3d9afd7b..64f4c61dd 100644 --- a/iOS/MainTimeline/Modern Cells/MainTimelineFeedCell.swift +++ b/iOS/MainTimeline/Modern Cells/MainTimelineFeedCell.swift @@ -92,12 +92,13 @@ class MainTimelineFeedCell: UITableViewCell { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.minimumLineHeight = UIFont.preferredFont(forTextStyle: .headline).pointSize paragraphStyle.maximumLineHeight = UIFont.preferredFont(forTextStyle: .headline).pointSize + paragraphStyle.lineBreakMode = .byTruncatingTail let titleAttributes: [NSAttributedString.Key: Any] = [ .font: UIFont.preferredFont(forTextStyle: .headline), .paragraphStyle: paragraphStyle, .foregroundColor: isSelected ? UIColor.white : UIColor.label ] - let titleWithNewline = cellData.title + "\n" + let titleWithNewline = cellData.title + (cellData.summary != "" ? "\n" : "" ) let titleAttributed = NSAttributedString(string: titleWithNewline, attributes: titleAttributes) attributedCellText.append(titleAttributed) } @@ -105,6 +106,7 @@ class MainTimelineFeedCell: UITableViewCell { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.minimumLineHeight = UIFont.preferredFont(forTextStyle: .body).pointSize paragraphStyle.maximumLineHeight = UIFont.preferredFont(forTextStyle: .body).pointSize + paragraphStyle.lineBreakMode = .byTruncatingTail let summaryAttributes: [NSAttributedString.Key: Any] = [ .font: UIFont.preferredFont(forTextStyle: .body), .paragraphStyle: paragraphStyle, diff --git a/iOS/MainTimeline/Modern Cells/MainTimelineIconFeedCell.swift b/iOS/MainTimeline/Modern Cells/MainTimelineIconFeedCell.swift index adb960c77..9bf804f01 100644 --- a/iOS/MainTimeline/Modern Cells/MainTimelineIconFeedCell.swift +++ b/iOS/MainTimeline/Modern Cells/MainTimelineIconFeedCell.swift @@ -121,12 +121,13 @@ class MainTimelineIconFeedCell: UITableViewCell { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.minimumLineHeight = UIFont.preferredFont(forTextStyle: .headline).pointSize paragraphStyle.maximumLineHeight = UIFont.preferredFont(forTextStyle: .headline).pointSize + paragraphStyle.lineBreakMode = .byTruncatingTail let titleAttributes: [NSAttributedString.Key: Any] = [ .font: UIFont.preferredFont(forTextStyle: .headline), .paragraphStyle: paragraphStyle, .foregroundColor: isSelected ? UIColor.white : UIColor.label ] - let titleWithNewline = cellData.title + "\n" + let titleWithNewline = cellData.title + (cellData.summary != "" ? "\n" : "" ) let titleAttributed = NSAttributedString(string: titleWithNewline, attributes: titleAttributes) attributedCellText.append(titleAttributed) } @@ -134,6 +135,7 @@ class MainTimelineIconFeedCell: UITableViewCell { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.minimumLineHeight = UIFont.preferredFont(forTextStyle: .body).pointSize paragraphStyle.maximumLineHeight = UIFont.preferredFont(forTextStyle: .body).pointSize + paragraphStyle.lineBreakMode = .byTruncatingTail let summaryAttributes: [NSAttributedString.Key: Any] = [ .font: UIFont.preferredFont(forTextStyle: .body), .paragraphStyle: paragraphStyle,