转自: https://blog.youkuaiyun.com/longge_li/article/details/83654333
昨天更新12.1之后,发现app 首页push一个界面,返回的时候,tabBar上的图标和文字出现一个从上往下的神奇动画,惊呆了?!
经过测试发现,如果使用系统OS12.1 UINavigationController + UITabBarController( UITabBar 磨砂),在popViewControllerAnimated 会遇到tabbar布局错乱的问题:
//下面的push方法可以不加(本人没有起作用)
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
if (self.childViewControllers.count > 0) {
//如果没这行代码,是正常显示的
viewController.hidesBottomBarWhenPushed = YES;
}
[super pushViewController:viewController animated:animated];
}
//**下面方案解决了我的问题
[UITabBar appearance].translucent = NO;
这个问题是 iOS 12.1 Beta 2 引入的问题,只要 UITabBar 是磨砂的,并且 push viewController 时 hidesBottomBarWhenPushed = YES 则手势返回的时候就会触发,出现这个现象的直接原因是 tabBar 内的按钮 UITabBarButton 被设置了错误的 frame,frame.size 变为 (0, 0) 导致的。
---------------------
作者:龙哥_love
来源:优快云
原文:https://blog.youkuaiyun.com/longge_li/article/details/83654333
版权声明:本文为博主原创文章,转载请附上博文链接!