我将导航控制器设置为拆分视图控制器的详细视图(NewFeedsNavigationController 继承自 UINavigationController)。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
masterViewController = [[MasterViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
NewsFeedsNavigationController *newsFeedsNavigationController = [[NewsFeedsNavigationController alloc] initWithCategories];
splitViewController = [[UISplitViewController alloc] init];
masterViewController.splitViewController = splitViewController;
splitViewController.viewControllers = [NSArray arrayWithObjects:masterNavigationController, newsFeedsNavigationController, nil];
splitViewController.delegate = newsFeedsNavigationController;
// Add the split view controller's view to the window and display.
[window addSubview:splitViewController.view];
[window makeKeyAndVisible];
return YES;
}
事实上,导航控制器在纵向上工作得很好,但在横向上有点吓人。当导航回层次结构(朝向根视图)时,我总是必须在每个视图中点击两次。第一次点击时,可见视图从堆栈中弹出,第二次点击时,导航栏会转动。通常,两者同时发生。我不知道出了什么问题。