[英]Change UITabBar selected view programmatically
我正在嘗試以編程方式更新我的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];
但是選項卡欄視圖沒有改變檢查此圖像:
通過設置selectedViewController:
func selectTab(atIndex index: Int) {
if index >= 0 && index < tabBarController.viewControllers.count {
tabBarController.selectedViewController = tabBarController.viewControllers[index]
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.