文章标题

来源:互联网 发布:钢雨篷计算软件 编辑:程序博客网 时间:2024/06/11 16:31

在使用
[self.navigationController popToRootViewControllerAnimated:YES];
的时候出现了这种情况:
这里写图片描述
解决这个问题的方法就是:遵循UINavigationController的代理,用代理方法解决该Bug,代码如下:
设置代理:

- (void)viewDidLoad{      [super viewDidLoad];      self.delegate = self;  }

实现代理

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated  {      // 删除系统自带的tabBarButton      for (UIView *tabBar in self.tabBarController.tabBar.subviews) {          if ([tabBar isKindOfClass:NSClassFromString(@"UITabBarButton")]) {              [tabBar removeFromSuperview];          }      }  }
原创粉丝点击