Return to initial view controller when user logs o

2019-02-04 19:06发布

I'm working on an app which uses Facebook integration, and the log in system works fine now. However, I can't seem to return to my initial view controller when the user clicks log out.

Here's an overview of my storyboard:

Screenshot of storyboard

I would like to return to the start when the user clicks the blue button (on the top). What would I do to achieve that? As you can see I have multiple Navigation Controllers, and I only use Push-seguesto get there. However, I do use the SWRevealViewController, which you can see in the middle.

I've tried [self.navigationController popToRootViewControllerAnimated:YES]; which doesn't do anything.

Any advice? Anyone familiar with the SWRevealViewController and what it might have done to my Navigation stack? Any help will be appreciated!

Thanks.

7条回答
Summer. ? 凉城
2楼-- · 2019-02-04 19:38

Try this,

UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"NameOfYourStoryBoard" 
                                                     bundle:nil];
LoginViewController *add = 
           [storyboard instantiateViewControllerWithIdentifier:@"viewControllerIdentifier"];

[self presentViewController:add 
                   animated:YES 
                 completion:nil];
查看更多
登录 后发表回答