收集箱列表展示完整文案
This commit is contained in:
@@ -246,6 +246,7 @@ extension ClipInboxViewController: UITableViewDataSource {
|
|||||||
|
|
||||||
var config = cell.defaultContentConfiguration()
|
var config = cell.defaultContentConfiguration()
|
||||||
config.text = previewText(for: clip.text)
|
config.text = previewText(for: clip.text)
|
||||||
|
config.textProperties.numberOfLines = 0
|
||||||
config.secondaryText = formattedDate(clip.createdAt)
|
config.secondaryText = formattedDate(clip.createdAt)
|
||||||
config.secondaryTextProperties.color = .secondaryLabel
|
config.secondaryTextProperties.color = .secondaryLabel
|
||||||
cell.contentConfiguration = config
|
cell.contentConfiguration = config
|
||||||
@@ -255,9 +256,7 @@ extension ClipInboxViewController: UITableViewDataSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func previewText(for text: String) -> String {
|
private func previewText(for text: String) -> String {
|
||||||
let lines = text.components(separatedBy: .newlines)
|
let preview = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
let firstTwoLines = Array(lines.prefix(2))
|
|
||||||
let preview = firstTwoLines.joined(separator: " ").trimmingCharacters(in: .whitespaces)
|
|
||||||
if preview.isEmpty {
|
if preview.isEmpty {
|
||||||
return "(无内容)"
|
return "(无内容)"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user