在我的 appdelagate 我有这个:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
MasterViewController *masterViewController = [[MasterViewController alloc] initWithNibName:@"MasterViewController_iPhone" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
我有一个 masterview 和 detailview,masterview 是一个表格,当我在 masterview 中单击一行时会推送到 detailview,但是我添加到 detailview 的 barbutton 项目不会显示。它看起来像这样:
DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController_iPhone" bundle:nil];
[self.navigationController pushViewController: detailViewController animated:YES];