iPhone X在push时tabBar往上偏移的问题

来源:互联网 发布:spss软件安装 编辑:程序博客网 时间:2024/05/22 12:36

最近iphoneX模拟器出来了,在适配iphoneX的时候发现tabbar在页面跳转的时候会出现往上跳一下的情况,百思不得其解,最终解决方案如下!






push的时候修改一下tabBar的frame。



- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { if (self.viewControllers.count > 0) { if ([viewController conformsToProtocol:@protocol(XYTransitionProtocol)] && [self isNeedTransition:viewController]) { viewController.hidesBottomBarWhenPushed = NO; }else { viewController.hidesBottomBarWhenPushed = YES; } } [super pushViewController:viewController animated:animated]; // 修改tabBar的frame CGRect frame = self.tabBarController.tabBar.frame; frame.origin.y = [UIScreen mainScreen].bounds.size.height - frame.size.height; self.tabBarController.tabBar.frame = frame;}

原创粉丝点击