Files
suixinkan_ios_new/suixinkan/Features/TravelAlbum/Views/TravelAlbumDetail/MiddleTruncatedText.swift
汉秋 5e620623eb 对齐旅拍相册详情页 Android UI,并修复网格预览与布局问题。
重构相册详情为信息卡片、Tab 筛选、排序、批量删除与底部上传栏;修复网格重叠、禁用按钮蒙层,并支持点击预览大图。同步扩展素材列表 API 与 ViewModel 分页逻辑,并优化有线传图缩略图与传输性能。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 13:53:59 +08:00

35 lines
1.1 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// MiddleTruncatedText.swift
// suixinkan
//
// Android MiddleEllipsisTextView
//
import SwiftUI
import UIKit
///
struct MiddleTruncatedText: UIViewRepresentable {
let text: String
var font: UIFont = .systemFont(ofSize: 11, weight: .regular)
var textColor: UIColor = UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 1)
/// UILabel
func makeUIView(context: Context) -> UILabel {
let label = UILabel()
label.lineBreakMode = .byTruncatingMiddle
label.numberOfLines = 1
label.setContentHuggingPriority(.required, for: .vertical)
label.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
label.setContentCompressionResistancePriority(.required, for: .vertical)
return label
}
///
func updateUIView(_ uiView: UILabel, context: Context) {
uiView.text = text
uiView.font = font
uiView.textColor = textColor
}
}