tabbar在iOS8 中重叠的情况.就是原本已经移除的UITabBarButton再次出现
既然是动态添加。那么按照apple的一贯作风。一定会调用viewWillAutolayout这个方法
- (void) viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
// 删除系统自动生成的UITabBarButton
for (UIView *child in self.tabBar.subviews) {
if ([child isKindOfClass:NSClassFromString(@"UITabBarButton")]) {
[child removeFromSuperview];
}
}
[super viewWillAppear:animated];
}
- (void)viewWillAppear:(BOOL)animated
{
// 删除系统自动生成的UITabBarButton
for (UIView *child in self.tabBar.subviews) {
if ([child isKindOfClass:[UIControl class]]) {
[child removeFromSuperview];
}
}
[super viewWillAppear:animated];
}
网友评论