wackytacky99
wackytacky99

Reputation: 614

What is the best way to switch between UIViewControllers without using a navigation controller in storyboard?

Please refer to the image below -

I'm not using NavigationViewController. Is there a way to switch between views when using storyboard and segues? I know the other way around would be to use a root view controller and switch views that way. Just wanted to know if there is a alternative way of doing this.

Thanks!

storyboard

Upvotes: 2

Views: 1203

Answers (2)

Rob
Rob

Reputation: 437882

You can either:

  1. Use a navigation controller, but just hide it (both in the Interface Builder design of the storyboard, as well as programmatically at runtime via setNavigationBarHidden:animated: in your viewDidLoad). Thus pushViewController (or a simple push segue) and popViewController work, without the navigation bar user interface.

  2. Use modal segues (i.e. behind the scenes it will do presentViewControllerAnimated) and dismissViewControllerAnimated.

Upvotes: 1

tarheel
tarheel

Reputation: 4797

It does not require a navigationController to use a segue. Just use the [self performSegueWithIdentifier:@"mySegue" sender:sender]; line anywhere you have a Segue set up and identified in your Storyboard.

Upvotes: 1

Related Questions