Reputation: 469
My scenario is, when app launched, user will need to login. After login, I will present a modal view controller B
on top of it. (Not push to navigation controller).
Now user can logout and go back to initial view controller A
. What I want to accomplish is present a brand new initial view controller. I've tried dismissViewController, but A
will show the state that before presented B
, maybe some sub-viewcontrollers of A
.
So I would like to present the initial controller instead of dismiss the current one.
I think this may cause potential memory issue since I just put a view controller on top of stack and the reset of them never deleted right?
If there is a memory issue, is there a better way to do it? (The complicated way is use delegate, while logout, manually reset the initial view controller)
Thanks
Upvotes: 0
Views: 869
Reputation: 307
You have to set the "View Controller B" as Initial Scene ("Is initial view Controller" on attribute inspector), when your application launch you have to programatically test if the user is logged in, if not, you have to present Login view controller as Modal and dismiss it after login.
presentViewController:animated:completion (presentModalViewController is Deprecated in iOS 6.0.)
or
performSegueWithIdentifier (if you are using Storyboards).
i hope have helped you.
Upvotes: 1