Compare commits
2 Commits
f888e28d15
...
a0dffdc715
| Author | SHA1 | Date | |
|---|---|---|---|
| a0dffdc715 | |||
| 4765d48021 |
@@ -246,8 +246,10 @@ extension ClipInboxViewController: UITableViewDataSource {
|
||||
|
||||
var config = cell.defaultContentConfiguration()
|
||||
config.text = previewText(for: clip.text)
|
||||
config.textProperties.numberOfLines = 0
|
||||
config.secondaryText = formattedDate(clip.createdAt)
|
||||
config.secondaryTextProperties.color = .secondaryLabel
|
||||
config.textToSecondaryTextVerticalPadding = 12
|
||||
cell.contentConfiguration = config
|
||||
cell.accessoryType = .disclosureIndicator
|
||||
|
||||
@@ -255,9 +257,7 @@ extension ClipInboxViewController: UITableViewDataSource {
|
||||
}
|
||||
|
||||
private func previewText(for text: String) -> String {
|
||||
let lines = text.components(separatedBy: .newlines)
|
||||
let firstTwoLines = Array(lines.prefix(2))
|
||||
let preview = firstTwoLines.joined(separator: " ").trimmingCharacters(in: .whitespaces)
|
||||
let preview = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
if preview.isEmpty {
|
||||
return "(无内容)"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user