我的 appdelegate 有问题。我想添加一个导航栏,但它不起作用。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.tabBarController = [[UITabBarController alloc] init];
UniversViewController *universViewController = [[UniversViewController alloc] initWithNibName:@"ProduitsListinTableViewController" bundle:nil];
universViewController.title = @"univers";
CategoriesViewController *categoriesViewController = [[CategoriesViewController alloc] initWithNibName:@"ProduitsListinTableViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:categoriesViewController];
navigationController.title = @"categories";
[navigationController setNavigationBarHidden:NO];
ProduitsListinTableViewController *produitListe = [[ProduitsListinTableViewController alloc] initWithNibName:@"ProduitsListinTableViewController" bundle:nil];
produitListe.title = @"troisième";
_tabBarController.viewControllers = [NSArray arrayWithObjects:universViewController, categoriesViewController, produitListe, nil];
[self.window setRootViewController:_tabBarController];
[self.window makeKeyAndVisible];
return YES;
}
我是否必须在 appdelegate 中添加一些内容UniversViewController
,CategoriesViewController
或者ProduitsListinTableViewController
这直接在 appdelegate 中?