Reputation: 1875
So here is the problem that I am facing:
I have an application that starts with a login view and has a tab bar with three buttons in the button. The left most button is "Home" button.
Now, I want for the "Home" tabbar button to direct the user to a different view than the login view once the user has logged in to the application. How can this be accomplished?
Thank you in advance. Shukaku
Upvotes: 1
Views: 435
Reputation: 4652
If I did this, I will make four views for it, one is loginView, others are three views for three tab button. loginView is independent one, so when the app start, it will load loginView and ask the user to login, and then if the user login, it will redirect to homeView, if not, will stay at loginView.
so in loginView, it has at least one button, and use this to redirect to homeView -
self.selectedIndex = 0; // self is an instance of UITabBarController
Upvotes: 1
Reputation: 7563
the simplest way i could think to accomplish this would be to create a view in the HomeViewController that contains two views: the LoginView and the AfterLoginView. mark the LoginView visible in your storyboard/XIB, and make the AfterLoginView hidden. once the user has logged in, make the transition from LoginView to the AfterLoginView by changing the hidden property on both in HomeViewController.
Upvotes: 1