Reputation: 27384
I wish to place a screen before my curren RootViewController. So far I have made the following modification to MyAppDelegate
:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//with this in the existing RootViewController loads correctly
//self.window.rootViewController = self.navigationController;
self.window.rootViewController = [[[HomePageController alloc] init] autorelease];
}
I'm not entirely sure how self.navigationController actually gets set to my RootViewController. Either way if I make the modification my HomePageController
does load correctly, however I am then unable to push another view on top of it. I have a simple button on HomePageController
that performs the following (note that HomePageController
should load the currently named RootViewController
, HomePageController
is the view I want to sit above this):
RootViewController *rvC = [[[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]] autorelease];
[self.navigationController pushViewController:rvC animated:YES];
When this code runs nothing happens... I'm not entirely sure why, possibly something related to the navigationController? Maybe I havent put HomePageController
above RootViewController
correctly or in the best way?
Upvotes: 0
Views: 2600
Reputation: 321
You have no navgiationController currently installed. To fix you have to replace
self.window.rootViewController = [[[HomePageController alloc] init] autorelease];
with
self.window.rootViewController = [[[UINavigatoinController alloc] initWithRootViewController:[[[HomePageController alloc] init] autorelease]] autorelease];
now you have navigationController installed and following
[self.navigationController pushViewController:rvC animated:YES];
will do the right job.
Upvotes: 4