iOS11 push控制器tabbar上移问题

时间:2022-05-18 06:29:03

解决方法

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated

{

// 如果有大于控制器

if (self.childViewControllers.count >= 1) {

viewController.hidesBottomBarWhenPushed = YES;

}

[super pushViewController:viewController animated:animated];

// 修正push控制器tabbar上移问题

if (@available(iOS 11.0, *)){

// 修改tabBra的frame

CGRect frame = self.tabBarController.tabBar.frame;

frame.origin.y = [UIScreen mainScreen].bounds.size.height - frame.size.height;

self.tabBarController.tabBar.frame = frame;

}

}