user3162102
user3162102

Reputation: 105

how to connect two viewcontrollers to same navigationcontroller in storyboard iphone

I am doing an application where i can check for a condition in Appdelegate class as follows:-

if([array count] == 0) {one viewController} else{another viewController}

How will i do this in storyboard like i'm asking the connection so that the corresponding viewcontrollers are displayed.

I'm new to iphone development.Thanks in advance.

Upvotes: 1

Views: 3318

Answers (1)

Femi
Femi

Reputation: 64700

The way to do this is:

  1. Create a regular UIViewController: this will be your root view controller.
  2. Create the 2 other UIViewControllers.
  3. Create 2 segues from the root view controller in step #1 to the 2 in step #2.
  4. Put your condition check in the viewDidAppear: launch the appropriate segue based on your condition.
  5. Embed the root view controller in a navigation controller (go to the Editor menu in Xcode and then select Embed In).

Upvotes: 4

Related Questions