在继承UITabBarController的类中实现以下方法
-(void)viewWillLayoutSubviews{
[superviewWillLayoutSubviews];
for(UIView*childinself.tabBar.subviews) {
if([childisKindOfClass:NSClassFromString(@"UITabBarButton")]) {
[childremoveFromSuperview];
}
}
}
- (void)viewWillAppear:(BOOL)animated
{
//删除系统自动生成的UITabBarButton
for(UIView*childinself.tabBar.subviews) {
if([childisKindOfClass:[UIControlclass]]) {
[childremoveFromSuperview];
}
}
[superviewWillAppear:animated];
}