阅读 65

iOS 14 使用popToRootViewControllerAnimated时tabbar不显示问题解决

重写UINavigationController方法

//iOS 14 使用popToRootViewControllerAnimated时tabbar不显示问题解决
- (NSArray<__kindof UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated {
    if (animated) {
        UIViewController *popController = self.viewControllers.lastObject;
        popController.hidesBottomBarWhenPushed = NO;
    }
    return [super popToRootViewControllerAnimated:animated];
}
复制代码

重写UIViewController init方法实现默认隐藏tabbar

//基类默认隐藏tabbar
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.hidesBottomBarWhenPushed = YES;
    }
    return self;
}
复制代码
文章分类
iOS
文章标签