2012-03-09 38 views
2

我有一個3個按鈕和一個包含3個視圖的tabbar控制器的視圖。我正在使用故事板。我想從我的視角轉到TabBar控制器的特定視圖。當我創建目標視圖的segway時,不包括tabbar。IOS從其他視圖轉到tabbar控制器的特定視圖

我發現的唯一方法是爲tabbar控制器本身創建一個segway,但默認情況下會顯示第一個視圖。

在此先感謝!

回答

8

Yess !!我得到了解決方案。執行以下操作:

在你的.h文件:

@property (strong, nonatomic) UITabBarController *tabController; 

在你.m文件:

@synthesize tabController; 

tabController = [self.storyboard instantiateViewControllerWithIdentifier:@"tabbar"]; 

選定的指標是你想要的標籤去

tabController.selectedIndex = 1; 

[[self navigationController] pushViewController:tabController animated:YES]; 
相關問題