From bbb46e62fda1c6d60706d3b8f45d1944f4a2f6fa Mon Sep 17 00:00:00 2001 From: CMK Date: Fri, 6 May 2022 15:17:46 +0800 Subject: [PATCH] fix: compose tabBar button layout raise crash on iPad issue --- Mastodon/Scene/Root/MainTab/MainTabBarController.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift index b91435a5..8970e2f2 100644 --- a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift +++ b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift @@ -406,8 +406,10 @@ extension MainTabBarController { switch traitCollection.horizontalSizeClass { case .compact: tabBar.isHidden = false + composeButttonShadowBackgroundContainer.isHidden = false default: tabBar.isHidden = true + composeButttonShadowBackgroundContainer.isHidden = true } } @@ -428,7 +430,7 @@ extension MainTabBarController { anchorImageView.alpha = 0 composeButttonShadowBackgroundContainer.translatesAutoresizingMaskIntoConstraints = false - tabBar.addSubview(composeButttonShadowBackgroundContainer) + self.view.addSubview(composeButttonShadowBackgroundContainer) // add to tabBar will crash on iPad when size class changing NSLayoutConstraint.activate([ composeButttonShadowBackgroundContainer.centerXAnchor.constraint(equalTo: anchorImageView.centerXAnchor), composeButttonShadowBackgroundContainer.centerYAnchor.constraint(equalTo: anchorImageView.centerYAnchor),