最近在实现iPhone X的适配过程中偶遇了一个问题,push的过程中tabbar的位置会往上移动

QQ20171018-112736-HD.gif
解决方法:
创建一BaseNavigationController继承于UINavigationController,重写pushViewController代理方法:
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
[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;
}