【发布时间】:2011-07-15 07:08:42
【问题描述】:
是否可以为 UITabBarController 中的选项卡之一更改/替换 ViewContoller(和视图)?
我想从特定选项卡以任意顺序在 3 个不同的 ViewController 之间切换(这就是 NavigationController 无法实现的原因)。
【问题讨论】:
标签: iphone uiviewcontroller uitabbarcontroller
是否可以为 UITabBarController 中的选项卡之一更改/替换 ViewContoller(和视图)?
我想从特定选项卡以任意顺序在 3 个不同的 ViewController 之间切换(这就是 NavigationController 无法实现的原因)。
【问题讨论】:
标签: iphone uiviewcontroller uitabbarcontroller
它们是使用 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];
希望对您有所帮助。
【讨论】: