我试图在我的根控制器上单击一个按钮后调用子视图。警告出现在我的AppDelegate中(代码在下面),但是我在根控制器中包含了我如何调用这个新子视图的方法,以防万一也有问题。 继续出现的警报是navController的本地声明隐藏了一个实例变量 当我启动应用程序(以前打开罚款)时,它现在只是退出...
#import "SEM2REDOAppDelegate.h"
#import "SEM2REDOViewController.h"
@implementation SEM2REDOAppDelegate
@synthesize window;
@synthesize navController;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self.window makeKeyAndVisible];
SEM2REDOViewController *firstController = [[SEM2REDOViewController alloc]
initWithNibName:@"SEM2REDOViewController" bundle:nil];
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:firstController];
[self setNavContorller:navController];
[window addSubview:[navController view]];
[navController release];
[firstController release];
return YES;
}
然后这是我的第一个视图控制器里面的方法
- (IBAction)chooseFirstMeeting:(id)sender {
SelectRotationController *selectView = [[SelectRotationController alloc]
initWithNibName:@"SelectView" bundle:[NSBundle mainBundle]];
[selectView.navigationItem setTitle:@"Select First Meeting"];
[self.navigationController pushViewController:self.selectRotationController animated:YES];
self.selectRotationController = selectView;
[selectView release];
}
我知道这可能是一个非常简单的问题,但我刚刚开始这个。在高中编程深入研究作为一门补充课程,所以我真的很感激任何帮助!