Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 5 Storyboards - Returning to Initial View Controller

I'm working on an application that uses the new Storyboard functionality in Xcode 4.2

Is there a way of programatically sending a user back to the initial view controller from any point within the application?

For example when a session expires and they need to login again (initial view controller is my login screen)

like image 483
Andy Davies Avatar asked Nov 29 '11 11:11

Andy Davies


1 Answers

I assume that you are using a UINavigationController. Then you can use the popToRootViewControllerAnimated: method. You should be able to do this with this line:

[self.navigationController popToRootViewControllerAnimated:NO]; // Put YES for animation.

You can read more about the UINavigationController in the docs.

like image 142
matsr Avatar answered Nov 15 '22 04:11

matsr