Search code examples
iosstoryboardsegueunwind-segue

Can I start my iOS app on the 2nd View of My Storyboard and use the Unwind Segue?


I have two views in my Xcode Storyboard:

Login Screen -> UITableView

Is it possible to launch my app so that the UITableView is the first screen to display, and have an unwind segue that will take the user back to the Login Screen?

I am currently able to set the self.window.rootViewController in the App Delegate to set the first screen, but none of the unwind segues work.

Here's How I Got it to Work I had to make sure my Login Screen had a Navigation Controller, then in the .m file for the Login Screen I used this code:

SecondViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"SecondViewControllerStoryboardId"];
[self.navigationController pushViewController:vc animated:NO];

Solution

  • Instead of explicitly setting your second view as rootViewController, just push it from your first view in its viewDidload method and then try unwind segues it will work.