我正在尝试以编程方式更新我的UITabBar
所选视图我尝试过以下代码:
UIViewController *currentView = self.frostedViewController.contentViewController;
NSLog(@"Current Index %lu", currentView.tabBarController.selectedIndex);
currentView.tabBarController.selectedIndex = 3;
NSLog(@"changing index %lu", currentView.tabBarController.selectedIndex);
//self.frostedViewController.contentViewController = categorie;
[self.frostedViewController hideMenuViewController];
但标签栏视图未更改检查此图片:
答案 0 :(得分:0)
通过设置selectedViewController:
func selectTab(atIndex index: Int) {
if index >= 0 && index < tabBarController.viewControllers.count {
tabBarController.selectedViewController = tabBarController.viewControllers[index]
}
}