我試圖巢中的UITabBar一樣裏面另外一個,像這樣:如何巢的UITabBarController
UITabBarController *tabController = [[UITabBarController alloc] init];
tabController.delegate = self;
UITabBarController *friendsTabController = [[UITabBarController alloc] init];
FindFriendsViewController *findFriendsController = [[FindFriendsViewController alloc] initWithNibName:@"FindFriendsViewController" bundle:nil];
findFriendsController.rootViewController = self;
UINavigationController *findFriendsNavController = [[UINavigationController alloc] initWithRootViewController:findFriendsController];
findFriendsNavController.tabBarItem.title = NSLocalizedString(@"Add", nil);
friendsTabController.viewControllers = [NSArray arrayWithObjects:friendStreamController, friendListController, findFriendsNavController, nil];
tabController.viewControllers = [NSArray arrayWithObjects:nearbyNavController, friendsTabController, meController, checkInController, logController, nil];
(顯然,一些代碼,如其他標籤被省略爲簡潔起見)
當我這樣做,並點擊外部標籤欄的「朋友」選項卡時,內部標籤欄直接出現在外部標籤欄上方。我不想要這個。我希望內部標籤欄在選擇外部標籤欄的時候(在窗口的底部)。
我試圖通過隱藏外部標籤欄,通過將其設置爲隱藏在UITabBarController委託方法,並試圖設置內部標籤欄的框架來手動將其置於底部的屏幕像這樣:
friendsTabController.tabBar.frame = CGRectMake(0, 430, 320, 50);
當我隱藏外標籤欄內層一個仍然顯示從屏幕的底部邊緣的距離相同,並且外一個是由一個空白矩形代替。
當我嘗試設置內部標籤欄的框架時,它唯一可見的部分是在外部標籤欄框架之外的任何部分。
我試過Google搜索這個無濟於事。這種導航當然不是很罕見?在嘗試這個之前,我曾假設它會在SDK中得到支持。
任何想法?
TIA,
湯姆
有趣的方法。我不確定這是否是好用戶界面,但這是我已經簽約做的:(我見過類似的導航邏輯使用像UISwitch這樣的控制器來執行子標籤欄的功能,通常放置在頂部 – TomL 2010-11-16 08:14:10
如果出現問題,請將答案標記爲正確。 – TomSwift 2010-11-16 17:39:08