![](/img/trans.png)
[英]How to change default ViewController of UITabBarController
[英]How to change items in UITabBarController
首先,您需要獲取數組的viewcontrollers並更改數組。 修改后分配回UITabBarController
NSMutableArray *viewCotrollers = [[NSMutableArray alloc]initWithArray:[tbc viewControllers]];
[viewCotrollers removeLastObject];
[tbc setViewControllers:viewCotrollers animated:YES];
要獲取TabBarController,您可以使用以下代碼
UITabBarController *tbc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"tabBarController"];
Todo你需要在故事板上為你的UITabBarController設置標識符
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.