How to display selected tab bars from a list of tab bars
I have one log in page in which I want ,if the user has logged in then he/she can view more 开发者_StackOverflow社区tabs than that showing to an unregistered user.It means logged in users can view more tabs. Can anybody please give me some idea?
Create your LoginViewController.
If the login is Successful, push the view to the TabBarController, which is your rootController, and you can code your stuff here.
If it is not successful, set UIAlerView letting them know that Login was incorrect, and provide mechanism for password recovery.
If you are starting from Scratch, I suggest that you get the TabBarViewController (rootController) first and get everything ready. Then work on the LoginViewController and just push it to the rootController (if the login is successful).
You can use
- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated
Set at first, when your user is not logged in, only the tabs common for all users, then when the user logs in, with setViewControllers:animated: you will be able to add the new and "private" tabs. Adding them with animated:YES
will give you a nice animated effect.
To customize your Tab's items, you can use this objects:
@property(nonatomic, retain) UITabBarItem *tabBarItem
If you need help, just tell me and i will give you more info.
精彩评论