2014-09-26 163 views
0

我寫具有以下結構的iPhone應用程序(在故事板創建)UITabBarControllerDelegate - 在哪裏放置代碼?

UIView --> TabBarController --> 1.NavigationController --> UITableView --> UIView 
           2.NavigationController --> UITableView --> UIPageController --> UIView 
           3.NavigationController --> UIView 
           ... 
           7.NavigationController --> UIView 

當單擊TabBarItem,我想要的頁面彈出到根視圖。

我知道我需要實現與方法UITabBarControllerDelegate

- (void)tabController:(UITabBarController *)tabController didSelectViewController: (UIViewController *)viewController 

我不明白的地方把這個方法和是否進行AppDelegate中的UITabBarDelegate,或使我customTabBarController類的委託。

另外,我在哪裏撥打tabBarController.delegate = self電話?

我是一個嚴重的小白,請幫助:)

+0

你在使用故事板嗎? – Leandro 2014-09-26 17:31:24

+0

是的,我正在使用故事板 – 2014-09-26 17:32:51

+0

viewControllers是否連接到tabBarController? – Leandro 2014-09-26 17:52:10

回答

1

如果你的AppDelegate有參考的UITabBarController,然後讓你的委託。