IOS5 - manual Storyboard view selection in code?

Up vote 2 down vote favorite share g+ share fb share tw.

I am new to iOS and using storyboards for the first time. When my app starts it checks back with the a server app I have written to see if the saved credentials are authenticated and I then in my AppDelegate class I then attempt to show the appropriate scene in the app's storyboard - MainMenu if authenticated or a Login Screen if not authenticated. I have tried using instantiateViewControllerWithIdentifier on the storyboard and also the performSegueWithIdentifier on the initial NavigationController which is set to be the "Initial View Controller" to display the appropriate view.. However with both methods only the blank navigation bar shows and I am unsure where to go from here.

If there was some example code on how others manually manipulate storyboard scenes and viewcontrollers that would be great. Am I maybe putting the code in the wrong place (ie should it go into the first View Controller) or should that not matter? No exceptions are raised and I seem to have access to instantiated objects as required.

I am thinking I need to understand the operation of the app delegate's window more, or maybe should I focus on manually loading the storyboard by removing it's reference from the InfoPlist settings? Any thoughts would be greatly appreciated. Ios5 storyboard link|improve this question asked Nov 17 '11 at 4:50PaulR111.

If (success) { self performSegueWithIdentifier: @"MainMenuSegue" sender: self; } else { self performSegueWithIdentifier: @"LoginSegue" sender: self; } To debug, I'd set up buttons on the initial viewcontroller just to be sure the segue linkings/etc are proper. You really shouldn't need to instantiateViewControllerWithIdentifier unless you're working around segue/storyboard limitations. I think.

I've put the performSegueWithIdentifier in my app's first viewcontroller's viewDidAppear (not the best idea, I think; but that's sort of the soonest it should happen? And I would hedge towards saying it should be triggered somewhere in the viewcontroller stack, not from the appdelegate, but I haven't tested that).

PerformSegueWithIdentifier: is an instance method of UIViewController. AppDelegate does not extend this class... – mmvie Dec 9 '11 at 20:59 That doesn't mean you can't call the instance method on the UIViewController from the AppDelegate.... But I really should extend my answer above. Lost track of it.

:) – Kaolin Fire Dec 10 '11 at 1:07 This works, but what if I don't want the view to animate in? – Van Du Tran Mar 13 at 14:50.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions