美文网首页
iOS8 自定义UITabBar (使用popToViewCon

iOS8 自定义UITabBar (使用popToViewCon

作者: 贺乾龙 | 来源:发表于2016-09-21 14:16 被阅读42次

在继承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];

}

相关文章

网友评论

      本文标题:iOS8 自定义UITabBar (使用popToViewCon

      本文链接:https://www.haomeiwen.com/subject/tjjaettx.html