UITabController和UINavigation结构的项目,如果navgationController push出来的页面,每个都设置了hidesBottomBarWhenPushed=true
,后续的第三层页面仍然会显示tab。
处理方法:
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
viewController.hidesBottomBarWhenPushed = viewControllers.count == 1
super.pushViewController(viewController, animated: animated)
}
override func setViewControllers(_ viewControllers: [UIViewController], animated: Bool) {
if viewControllers.count > 0 {
viewControllers[1].hidesBottomBarWhenPushed = true
}
super.setViewControllers(viewControllers, animated: animated)
}
相关答复见: 官方论坛