Doom
Doom

Reputation: 1278

call navigationcontroller with modalview?

I have a problem, I have made this:

Impostazioni *impostazioni=[[Impostazioni alloc] initWithNibName:@"Impostazioni" bundle:nil]; 
[self.navigationController presentModalViewController:aiuto animated:YES];

But I want to preserve the navigation bar in this modality:

[self.navigationController pushViewController:aiuto animated:YES];
[self.navigationController.navigationBar.backItem  setTitle:@"iCalory"];

And I want use presentModalView how can I this? thanks

Upvotes: 0

Views: 409

Answers (2)

Pugalmuni
Pugalmuni

Reputation: 9390

To add navigation controller in your code,

 Impostazioni *impostazioni=[[Impostazioni alloc] initWithNibName:@"Impostazioni" bundle:nil]; 

 UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController: impostazioni] autorelease];

 [self.navigationController presentModalViewController:navigationController animated:YES];

Upvotes: 3

Simon Goldeen
Simon Goldeen

Reputation: 9080

Just add your view controller to a new navigation controller and present the navigation controller modally:

UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController: aiuto] autorelease];
[self presentModalViewController navigationController];

Upvotes: 1

Related Questions