昨天更新12.1之后豺型,發(fā)現(xiàn)app 首頁push一個界面毁涉,返回的時候屑柔,tabBar上的圖標和文字出現(xiàn)一個從上往下的神奇動畫屡萤,驚呆了??!
經過測試發(fā)現(xiàn)掸宛,如果使用系統(tǒng)OS12.1 UINavigationController + UITabBarController( UITabBar 磨砂)死陆,在popViewControllerAnimated 會遇到tabbar布局錯亂的問題:
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
? if (self.childViewControllers.count > 0) {
? ? ? //如果沒這行代碼,是正常顯示的
? ? ? viewController.hidesBottomBarWhenPushed = YES;
? }
? [super pushViewController:viewController animated:animated];
}
這個問題是 iOS 12.1 Beta 2 引入的問題唧瘾,只要 UITabBar 是磨砂的措译,并且 push viewController 時 hidesBottomBarWhenPushed = YES 則手勢返回的時候就會觸發(fā),出現(xiàn)這個現(xiàn)象的直接原因是 tabBar 內的按鈕 UITabBarButton 被設置了錯誤的 frame饰序,frame.size 變?yōu)?(0, 0) 導致的领虹。
所以最簡單的解決方案就是:
[UITabBar appearance].translucent = NO;
---------------------原文:https://blog.csdn.net/longge_li/article/details/83654333
我是將這句話放到了自定義的tabbarController的viewdidload方法中,暫時測試無問題了