1

I'm using pushViewController from my home view to go to the logoutView. After logout, I'm using a performSegue to redirect to the loginView.

Can it be a problem if I didn't use popViewController? (In term of stack or something like that).

2)

This is like that

(1) LoginViewController --> Prepare for segue --> HomeViewController --> PushViewController --> LogoutViewController

So from logoutViewController, what can I do go to back safely in LoginViewController ?

Edit : I did it. Thanks

Aymenworks
  • 423
  • 7
  • 21

1 Answers1

1

I would highly, strongly recommend that you NOT do that. I am almost certain that you will pop another log-in controller onto the view controller stack. You will then have 4 view controllers in the stack when you only want one. Please look at this post on unwind segues or use popViewController.

http://stackoverflow.com/questions/12561735/what-are-unwind-segues-for-and-how-do-you-use-them
blackirishman
  • 903
  • 1
  • 10
  • 23
  • Can I use popViewController from the first view when I am in for exemple the fourth view pushed ? – Aymenworks Apr 29 '14 at 19:14
  • I think you want the login view controller at the bottom of the stack (the first view controller) and then always push onto that stack. If you want to log out, provide the user a way to get back to the login view controller either though popViewController or unwind segues. – blackirishman Apr 29 '14 at 19:24
  • I'm little confused. Please look at my edit , second question – Aymenworks Apr 29 '14 at 19:38
  • I am curious why you need a logout view controller. You can log out from any view controller and unwind back to your login view controller. You could add a log out button to your navigation bar or add a log out button to any view. At some point you will need to get back to your login view controller. – blackirishman Apr 29 '14 at 21:08
  • Excuse me I have a last question. When doing unwind, it popBack all previous view pushed. It's ok if I'm doing it either in code ( self.navigationController pushViewContronller ) or via push segue in storyboard ? or it's necessary doing it all push in code or all push in storyboard ? – Aymenworks Apr 29 '14 at 22:06
  • If the question is: Can I push viewControllers onto one another and then unwind using segues at the end? Yes you can. – blackirishman Apr 30 '14 at 00:35