I am trying to call a subview after a button is clicked on my root controller. The warnings appear in my AppDelegate (code is below), but I included the method from my root controller on how I call this new subview also in case that too has a problem.
the alerts that continue to come up are that the local declaration of navController hides an instance variable.
When I launch the application (which used to open fine) it now simply exits out…
#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;
}
then here is the method inside of my first view controller
- (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];
}
I know this may be an extremely simple question but I’ve just started this. doing an intensive study on programming in high school as an added course so I’d really appreciate any help!
Rename navController
into something else. You can do this automatically by control-clicking word “navController”, choosing “Refactor” from context menu, and then “Rename…”.
Explanation:
The problem, I believe, in your local variable navController having the same name as instance variable under synthesized declared property navController.
Edit:
Also, this seems to be a typo:
Correct: