iOS自定义TabBar使用popToRootViewControllerAnimated返回后tabbar重叠

解决方法

所以方法就是:遵循UINavigationController的代理,用代理方法解决该Bug,代码如下:

 

实现代理方法:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated  
  1. {  
  2. // 删除系统自带的tabBarButton  
  3. for (UIView *tabBar in self.tabBarController.tabBar.subviews) {  
  4. if ([tabBar isKindOfClass:NSClassFromString(@"UITabBarButton")]) {  
  5.             [tabBar removeFromSuperview];  
  6.         }  
  7.     }  
  8. }  
posted @ 2016-11-03 14:46  不停奔跑的蜗牛  阅读(1613)  评论(0)    收藏  举报