我们在应用委托中使用了以下代码。但是我们在导航控制器的 setTitle 函数中遇到了错误。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
UIViewController* viewController3=[[ThirdViewController alloc]initWithNibName:@"ThirdViewController" bundle:nil];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2,viewController3, nil];
NavigationViewController* navigationViewController=[[NavigationViewController alloc]initWithRootViewController:self.tabBarController];
self.navigationItem.title=@"news";
self.window.rootViewController = navigationViewController;
[self.window makeKeyAndVisible];
return YES;
}