因为我的项目用的是storyboard布局的,新建一个类BaseNavigationController继承UINavigationController,然后重写- (void)pushViewController:(UIViewController*)viewController animated:(BOOL)animated这个方法;
代码:
- (void)pushViewController:(UIViewController*)viewController animated:(BOOL)animated {
[superpushViewController:viewControlleranimated:animated];
//改tabBar的frame 在iPhoneX上push上移的问题
CGRectframe =self.tabBarController.tabBar.frame;
frame.origin.y= [UIScreenmainScreen].bounds.size.height- frame.size.height;
self.tabBarController.tabBar.frame= frame;
}
然后在storyboard里面,控制器的navigationController继承与这个类BaseNavigationController;
网友评论