1

UITableView Controller の周りに UITabBarController を作成しようとしています。私はこのコードを使用しています。しかし問題は、これを使用するとナビゲーション バーが消えることです。これを回避するにはどうすればよいですか?

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;
4

1 に答える 1

1

UINavigationController をナビゲーション バーに追加する必要があるほか、ビューの階層を維持する必要があります

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;
于 2012-08-24T11:01:41.433 に答える