fix: set empty view content center vertical alignment

This commit is contained in:
CMK 2021-06-16 14:00:58 +08:00
parent 59dda3c469
commit 2fac337ef5
1 changed files with 6 additions and 3 deletions

View File

@ -104,7 +104,7 @@ extension PickServerEmptyStateView {
]) ])
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
bottomPaddingView.heightAnchor.constraint(equalTo: topPaddingView.heightAnchor, multiplier: 2.0), bottomPaddingView.heightAnchor.constraint(equalTo: topPaddingView.heightAnchor, multiplier: 1.0),
]) ])
activityIndicatorView.hidesWhenStopped = true activityIndicatorView.hidesWhenStopped = true
@ -126,15 +126,18 @@ struct PickServerEmptyStateView_Previews: PreviewProvider {
emptyStateView.activityIndicatorView.stopAnimating() emptyStateView.activityIndicatorView.stopAnimating()
return emptyStateView return emptyStateView
} }
.previewLayout(.fixed(width: 375, height: 400)) .previewLayout(.fixed(width: 375, height: 150))
.previewDisplayName("Bad Network")
UIViewPreview(width: 375) { UIViewPreview(width: 375) {
let emptyStateView = PickServerEmptyStateView() let emptyStateView = PickServerEmptyStateView()
emptyStateView.networkIndicatorImageView.isHidden = true
emptyStateView.infoLabel.text = L10n.Scene.ServerPicker.EmptyState.findingServers emptyStateView.infoLabel.text = L10n.Scene.ServerPicker.EmptyState.findingServers
emptyStateView.infoLabel.textAlignment = UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft ? .right : .left emptyStateView.infoLabel.textAlignment = UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft ? .right : .left
emptyStateView.activityIndicatorView.startAnimating() emptyStateView.activityIndicatorView.startAnimating()
return emptyStateView return emptyStateView
} }
.previewLayout(.fixed(width: 375, height: 400)) .previewLayout(.fixed(width: 375, height: 44))
.previewDisplayName("Loading…")
} }
} }
} }