标签:storyboard tabbarcontroller dynamic change
假如你是使用storyboard上构建的tabbarcontroller,TabbarController上有3个item这时候你想在代码里动态变更成2个,保留第一个和第三个,去掉中间一个,怎么办?
只需要用以下代码就搞定了:
UITabBarController *tabBarController = (UITabBarController *)[UIApplication sharedApplication].delegate.window.rootViewController; NSMutableArray *tabbarViewControllers = [NSMutableArray arrayWithArray: [tabBarController viewControllers]]; [tabbarViewControllers removeObjectAtIndex:1]; [tabBarController setViewControllers: tabbarViewControllers ];
storyboard时动态改变tabbarcontroller上tabbar数量
标签:storyboard tabbarcontroller dynamic change
原文地址:http://blog.csdn.net/dauihiy/article/details/44056731