我的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;
}
我一定要在UniversViewController
,CategoriesViewController
和ProduitsListinTableViewController
添加的东西或这是直接在的appdelegate?
嗨,谢谢,这是完美的,它的工作原理!我添加了viewController1.title = @“TITLE”;所以标题直接出现。再次感谢你! – hhd59