最近在實現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;
}