是否可以更改/替换 UITabBarController 中选项卡之一的 ViewContoller(和 View )?
我想从特定选项卡以任意顺序在 3 个不同的 ViewController 之间切换(这就是导航 Controller 不可能的原因)。
最佳答案
它们是使用 setViewControllers:animated: 设置(批量)的,所以你可以做这样的事情。
// Assume tabController is the tab controller
// and newVC is the controller you want to be the new view controller at index 0
NSMutableArray *newControllers = [NSMutableArray arrayWithArray:tabController.viewControllers];
[newControllers replaceObjectAtIndex:0 withObject:newVC];
[tabController setViewControllers:newControllers animated:YES];
希望有帮助。
关于iphone - 更改 TabBarItem 的 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5303787/