Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dismissing a navigation view controller

I am currently working on a game for the iOS platform. The game's initial view controller is a login screen, and once the player logs in, he gets to a loading screen, and then a navigation view controller containing a table view with a list of current games. The storyboard's relevant view relations look like this:

[login screen] --modalsegue-> [loading screen] --modalsegue-> [navigation controller] --relationship-> [tableview (with logout button)]

I want to make a logout button at the bottom bar of the navigation view's [table view], which takes the player back to the [login screen]. How can I do this?

Thanks in advance!

like image 948
Henrik Hillestad Løvold Avatar asked Dec 09 '13 13:12

Henrik Hillestad Løvold


2 Answers

You can dismiss, self.presentingViewController.presentingViewController or you can use dismissToRootViewController.

like image 99
hemkaran_raghav Avatar answered Sep 21 '22 12:09

hemkaran_raghav


[self.navigationController dismissViewControllerAnimated:YES completion:nil];

like image 21
Zhuo Tao Avatar answered Sep 22 '22 12:09

Zhuo Tao