2012-08-24 44 views
1

我想在我的UITableView控制器周圍創建一個UITabBarController。我正在使用此代碼。但問題是,當使用這個導航欄消失。我如何解決這個問題?UITabBar中的UITableViewController

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
// Override point for customization after application launch. 
StyledTableViewController *viewController1 = [[StyledTableViewController alloc] initWithNibName:@"StyledTableViewController" bundle:nil]; 

self.tabBarController = [[UITabBarController alloc] init]; 
self.tabBarController.viewControllers = @[viewController1]; 
self.window.rootViewController = self.tabBarController; 
[self.window makeKeyAndVisible]; 
return YES; 

回答

1

極品的UINavigationController添加到導航欄,再加上它matain您的看法層次

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
StyledTableViewController *viewController1 = [[StyledTableViewController alloc] initWithNibName:@"StyledTableViewController" bundle:nil]; 
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:viewController1]; 

self.tabBarController = [[UITabBarController alloc] init]; 
self.tabBarController.viewControllers = @[navController]; 
self.window.rootViewController = self.tabBarController; 
[self.window makeKeyAndVisible]; 
return YES; 
+0

啊,我明白了簡單的解決方案。謝謝。 –