你能帮我做这个吗?我正在创建一个应用程序并且我正在使用一个主/详细信息应用程序,然后我添加了一个名为 MenuViewController 的新类,我希望它成为我的应用程序启动时加载的初始视图。我能够做到,但我的 MasterViewController 不再工作了,每次我单击表视图中的一个项目时,它都会显示另一个名为 DetailViewController 的视图,但是自从我更改了默认视图后,它不再显示 DetailViewController
这是我完成的一段代码
在 appdelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
MenuViewController *menuView = [[[MenuViewController alloc]initWithNibName:@"MenuViewController" bundle:nil]autorelease];
MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController" bundle:nil] autorelease];
self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
self.window.rootViewController = menuView;
[self.window makeKeyAndVisible];
return YES;
}
在我的 MenuViewController.m
// Created by Jan Arman Capistrano on 2/6/13.
// Copyright (c) 2013 Jan Arman Capistrano. All rights reserved.
//
#import "MenuViewController.h"
#import "MasterViewController.h"
@interface MenuViewController ()
@end
@implementation MenuViewController
-(IBAction)nextView:(id)sender
{
MasterViewController *masterViewc = [[MasterViewController alloc]initWithNibName:nil bundle:nil];
[self presentViewController:masterViewc animated:YES completion:nil];
}