iPhone X在push時tabBar往上偏移的問題

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章