因?yàn)槲业捻?xiàng)目用的是storyboard布局的,新建一個(gè)類BaseNavigationController繼承UINavigationController,然后重寫- (void)pushViewController:(UIViewController*)viewController animated:(BOOL)animated這個(gè)方法;
代碼:
- (void)pushViewController:(UIViewController*)viewController animated:(BOOL)animated {
[superpushViewController:viewControlleranimated:animated];
//改tabBar的frame 在iPhoneX上push上移的問(wèn)題
CGRectframe =self.tabBarController.tabBar.frame;
frame.origin.y= [UIScreenmainScreen].bounds.size.height- frame.size.height;
self.tabBarController.tabBar.frame= frame;
}
然后在storyboard里面,控制器的navigationController繼承與這個(gè)類BaseNavigationController;
