fix: emptyView use tableView.readableContentGuide in pick server scene

This commit is contained in:
sunxiaojian 2021-04-24 21:50:14 -07:00
parent e3001c772a
commit 078c89adc7
1 changed files with 10 additions and 9 deletions

View File

@ -84,15 +84,6 @@ extension MastodonPickServerViewController {
nextStepButton.heightAnchor.constraint(equalToConstant: MastodonPickServerViewController.actionButtonHeight).priority(.defaultHigh), nextStepButton.heightAnchor.constraint(equalToConstant: MastodonPickServerViewController.actionButtonHeight).priority(.defaultHigh),
view.layoutMarginsGuide.bottomAnchor.constraint(equalTo: nextStepButton.bottomAnchor, constant: WelcomeViewController.viewBottomPaddingHeight), view.layoutMarginsGuide.bottomAnchor.constraint(equalTo: nextStepButton.bottomAnchor, constant: WelcomeViewController.viewBottomPaddingHeight),
]) ])
emptyStateView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(emptyStateView)
NSLayoutConstraint.activate([
emptyStateView.topAnchor.constraint(equalTo: view.topAnchor),
emptyStateView.leadingAnchor.constraint(equalTo: view.readableContentGuide.leadingAnchor),
emptyStateView.trailingAnchor.constraint(equalTo: view.readableContentGuide.trailingAnchor),
nextStepButton.topAnchor.constraint(equalTo: emptyStateView.bottomAnchor, constant: 21),
])
// fix AutoLayout warning when observe before view appear // fix AutoLayout warning when observe before view appear
viewModel.viewWillAppear viewModel.viewWillAppear
@ -125,6 +116,16 @@ extension MastodonPickServerViewController {
nextStepButton.topAnchor.constraint(equalTo: tableView.bottomAnchor, constant: 7), nextStepButton.topAnchor.constraint(equalTo: tableView.bottomAnchor, constant: 7),
]) ])
emptyStateView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(emptyStateView)
NSLayoutConstraint.activate([
emptyStateView.topAnchor.constraint(equalTo: view.topAnchor),
emptyStateView.leadingAnchor.constraint(equalTo: tableView.readableContentGuide.leadingAnchor),
emptyStateView.trailingAnchor.constraint(equalTo: tableView.readableContentGuide.trailingAnchor),
nextStepButton.topAnchor.constraint(equalTo: emptyStateView.bottomAnchor, constant: 21),
])
view.sendSubviewToBack(emptyStateView)
switch viewModel.mode { switch viewModel.mode {
case .signIn: case .signIn:
nextStepButton.setTitle(L10n.Common.Controls.Actions.signIn, for: .normal) nextStepButton.setTitle(L10n.Common.Controls.Actions.signIn, for: .normal)