fix: 优化旅拍相册入口与二维码提示布局

This commit is contained in:
2026-07-23 15:40:51 +08:00
parent 787a166263
commit 7ccbc5568d
2 changed files with 41 additions and 5 deletions

View File

@ -20,7 +20,9 @@ final class TravelAlbumCodeDialogViewController: UIViewController {
private let albumNameLabel = UILabel()
private let qrImageView = UIImageView()
private let loadingIndicator = UIActivityIndicatorView(style: .medium)
private let hintLabel = UILabel()
private let hintLabel = TravelAlbumCodeHintLabel(
contentInsets: UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)
)
private let downloadButton = UIButton(type: .system)
init(state: TravelAlbumEntryViewModel.AlbumCodeState) {
@ -117,8 +119,8 @@ final class TravelAlbumCodeDialogViewController: UIViewController {
hintLabel.snp.makeConstraints { make in
make.top.equalTo(qrImageView.snp.bottom).offset(18)
make.centerX.equalToSuperview()
make.height.equalTo(34)
make.leading.greaterThanOrEqualToSuperview().offset(20)
make.trailing.lessThanOrEqualToSuperview().offset(-20)
}
downloadButton.snp.makeConstraints { make in
make.top.equalTo(hintLabel.snp.bottom).offset(20)
@ -160,3 +162,30 @@ final class TravelAlbumCodeDialogViewController: UIViewController {
onDownload?()
}
}
/// Android
private final class TravelAlbumCodeHintLabel: UILabel {
private let contentInsets: UIEdgeInsets
init(contentInsets: UIEdgeInsets) {
self.contentInsets = contentInsets
super.init(frame: .zero)
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func drawText(in rect: CGRect) {
super.drawText(in: rect.inset(by: contentInsets))
}
override var intrinsicContentSize: CGSize {
let size = super.intrinsicContentSize
return CGSize(
width: size.width + contentInsets.left + contentInsets.right,
height: size.height + contentInsets.top + contentInsets.bottom
)
}
}