From 078c89adc7541cd7f0695d8c6a79a9f164e0f1d7 Mon Sep 17 00:00:00 2001 From: sunxiaojian Date: Sat, 24 Apr 2021 21:50:14 -0700 Subject: [PATCH] fix: emptyView use tableView.readableContentGuide in pick server scene --- .../MastodonPickServerViewController.swift | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift index 39ed714d..06fc4ce2 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift @@ -84,15 +84,6 @@ extension MastodonPickServerViewController { nextStepButton.heightAnchor.constraint(equalToConstant: MastodonPickServerViewController.actionButtonHeight).priority(.defaultHigh), 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 viewModel.viewWillAppear @@ -125,6 +116,16 @@ extension MastodonPickServerViewController { 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 { case .signIn: nextStepButton.setTitle(L10n.Common.Controls.Actions.signIn, for: .normal)