I want to navigate between the ViewController of an app by clicking a button and switching from one to another for example. But I did not want to do this for the .storyboard, I want to do it directly via code. It's possible? If so, how can I do it?
I want to navigate between the ViewController of an app by clicking a button and switching from one to another for example. But I did not want to do this for the .storyboard, I want to do it directly via code. It's possible? If so, how can I do it?
You can use the pushViewController:
or presentViewController:
". First you need to get an instance of your UIViewController
that will open and that is on the storyboard via the identifier:
SegundaViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"segundaView"];
Now you do the push from navigationController
:
[[self navigationController] pushViewController:viewController animated:YES];
Or open as a modal:
[self presentViewController:viewController animated:YES completion:nil];