轩轩ios学习

移除TabBar原有的button的时间

2016-03-08  本文已影响104人  咬鹃
![打印结果.png](https://img.haomeiwen.com/i1511652/8da3100aef497080.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
-(void)viewWillAppear:(BOOL)animated
{

//    [super viewWillAppear:animated];
    NSLog(@"移除之前个数-----%zd",self.tabBar.subviews.count);
    
    // 移除tabBar之前的按钮
    for (UIView *childView in self.tabBar.subviews) {
        
        if (![childView isKindOfClass:[ZSTabBar class]]) {
            
            [childView removeFromSuperview];
        }
    }
    
    NSLog(@"移除之后个数----%zd",self.tabBar.subviews.count);
}
打印结果.png tabBar.png

- (void)viewWillAppear:(BOOL)animated
{

    [super viewWillAppear:animated];
    NSLog(@"移除之前个数-----%zd",self.tabBar.subviews.count);
    
    // 移除tabBar之前的按钮
    for (UIView *childView in self.tabBar.subviews) {
        
        if (![childView isKindOfClass:[ZSTabBar class]]) {
            
            [childView removeFromSuperview];
        }
    }
    
    NSLog(@"移除之后个数----%zd",self.tabBar.subviews.count);
}
改完之后.png 改完之后tabBar.png
上一篇下一篇

猜你喜欢

热点阅读