问题
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.
回答1:
The way to do this is:
- Create a regular UIViewController: this will be your root view controller.
- Create the 2 other UIViewControllers.
- Create 2 segues from the root view controller in step #1 to the 2 in step #2.
- Put your condition check in the viewDidAppear: launch the appropriate segue based on your condition.
- Embed the root view controller in a navigation controller (go to the Editor menu in Xcode and then select Embed In).
来源:https://stackoverflow.com/questions/22446046/how-to-connect-two-viewcontrollers-to-same-navigationcontroller-in-storyboard-ip