iOS14 iOS14.1版本上均发现,在导航popToRoot返回到时候Tabbar会消失,并无法进行返回操作,解决方法如下:
override func popToRootViewController(animated: Bool) -> [UIViewController]? {
guard #available(iOS 14, *) else {
return super.popToRootViewController(animated: animated)
}
viewControllers.forEach({$0.hidesBottomBarWhenPushed = false})
return super.popToRootViewController(animated: animated)
}
···swift
override func pushViewController(_ viewController: UIViewController, animated: Bool) {
if self.viewControllers.count == 1{
viewController.hidesBottomBarWhenPushed = true
}else{
viewController.hidesBottomBarWhenPushed = false
}
super.pushViewController(viewController, animated: animated)
}