Compare commits
2 Commits
f888e28d15
...
a0dffdc715
| Author | SHA1 | Date | |
|---|---|---|---|
| a0dffdc715 | |||
| 4765d48021 |
@@ -246,8 +246,10 @@ 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
|
||||||
|
config.textToSecondaryTextVerticalPadding = 12
|
||||||
cell.contentConfiguration = config
|
cell.contentConfiguration = config
|
||||||
cell.accessoryType = .disclosureIndicator
|
cell.accessoryType = .disclosureIndicator
|
||||||
|
|
||||||
@@ -255,9 +257,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