fix: 优化旅拍相册入口与二维码提示布局
This commit is contained in:
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user