I would like to prompt a user to sign in with a UIAlertView when the user presses a certain tab bar item in a tab bar controller.
This tab bar controller exists in storyboard, and as a result I'm not sure where i can do this. Apple claims that UITabBarController shouldn't be subclassed, further adding to my confusion. And furthermore, i am aware of UITabBarController's delegate pattern but i don't know what view controller i can hook it up to Note: My UITabBarController is generated from a modal segue from a UIViewController.
Thank you in advance.
I found the answer to this when answering another of my own questions, here.
I used the uitabbarcontrollerdelegate and set that in the root controller.
You can display your alert view when the selected view controller is displayed... Say you have a LoginViewController
in the tab bar. inside that class create a method
- (void)viewDidAppear:(BOOL)animated;
which displays the alert view
Also look at the UITabBarDelegate
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.