问题
I'm using a UIScrollView to display some images, and i need to present or push another view when the user selects one part of the image.This ScrollView is created only programmatically. How i can programmatically add a navigationController to it and present another view?
I tried this way but just give me the following error :
Pushing a navigation controller is not supported'
StatesViewController * controller = [[StatesViewController alloc]initWithNibName:@"StatesViewController" bundle:nil];
UINavigationController * Navcontroller = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentModalViewController: Navcontroller animated: YES];
回答1:
this might help you.
NextViewController *nextViewController=[[NextViewController alloc]initWithNibName:@"NextViewController" bundle:nil];
UINavigationController *navBar=[[UINavigationController alloc]initWithRootViewController:nextViewController];
[self.navigationController presentModalViewController:navBar animated:YES];
来源:https://stackoverflow.com/questions/12412526/add-navigationcontroller-to-current-view