<pre name="code" class="objc">/**
* 视图即将显示的时候会调用这个方法
*/
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
//删掉系统默认的tabBarItem
for (UIView *child in self.tabBar.subviews) {
if ([child isKindOfClass:[UIControl class]]) {
[child removeFromSuperview];
}
}
}
/**
* 初始化tabBar
*/
- (void)setupTabbar
{
TabBar *customTabBar = [[TabBar alloc]init];
customTabBar.delegate = self; //控制器成为代理
customTabBar.frame = self.tabBar.bounds;
[self.tabBar addSubview:customTabBar];
self.customTabBar = customTabBar;
}
自定义tabBar
最新推荐文章于 2024-07-24 17:43:32 发布