我只是无法在我的每个标签栏项目视图中获得导航控制器(和栏)。这是我的 appdelegate ,我错过了什么?FrontPage
并且Opinion
也是tableviewcontrollers,只是忘记了他们名字中的表格。
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
FrontPageViewController *frontPageVC = [[FrontPageViewController alloc] initWithNibName:nil bundle:nil];
frontPageVC.title = @"Front Page";
frontPageVC.tabBarItem.image = [UIImage imageNamed:@"second"];
UINavigationController *frontPageNavController = [[UINavigationController alloc] initWithRootViewController:frontPageVC];
CampusTableViewController *campusVC = [[CampusTableViewController alloc] initWithNibName:nil bundle:nil];
campusVC.title = @"Campus";
campusVC.tabBarItem.image = [UIImage imageNamed:@"second"];
UINavigationController *campusNavController = [[UINavigationController alloc] initWithRootViewController:campusVC];
OpinionViewController *opinionVC = [[OpinionViewController alloc] initWithNibName:nil bundle:nil];
opinionVC.title = @"Opinion";
opinionVC.tabBarItem.image = [UIImage imageNamed:@"second"];
UINavigationController *opinionNavController = [[UINavigationController alloc] initWithRootViewController:opinionVC];
SportsTableViewController *sportsVC = [[SportsTableViewController alloc] initWithNibName:nil bundle:nil];
sportsVC.title = @"Sports";
sportsVC.tabBarItem.image = [UIImage imageNamed:@"second"];
UINavigationController *sportsNavController = [[UINavigationController alloc] initWithRootViewController:sportsVC];
PDFViewController *pdfVC = [[PDFViewController alloc] initWithNibName:nil bundle:nil];
NSArray *controllers = [NSArray arrayWithObjects:frontPageVC, campusVC, opinionVC, sportsVC, pdfVC, nil];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = controllers;
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
[[self.tabBarController.viewControllers objectAtIndex:0] setRootViewController:frontPageNavController];
}
谢谢你!
编辑:显然我需要输入更多来解释我的问题,因为SO不会让我在没有一定数量的单词的情况下发帖?