I set up a navigation controller as detail view of a split view controller (NewFeedsNavigationController is inherited from 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;
}
开发者_如何学C
As a matter of fact the navigation controller works splendidly in the portrait orientation but kind of freaks out in landscape orientation. When navigating back in the hierarchy (towards the root view) I always have to tap twice per view. Upon the first tap, the visible view is popped from the stack and upon the second tap, the navigation bar turns. Usually, both happen at the same time. I have no idea what is going wrong.
I was mistaken. the erroneous behavior persists in the latest release, but I found the solution for my case. You must not derive a custom UINavigationController subclass. It even says so in the view controller programmers guide. Following that restriction I was able to solve all my issues.
精彩评论