First set the agent for Uitabbarcontroller as appdelegate as follows: Mytabbar.delegate = self;
Then write a proxy on the back of interface <UITabBarControllerDelegate>
Implement the agent inside the-(BOOL) Tabbarcontroller: (Uitabbarcontroller *) Tabbarcontroller Shouldselectviewcontroller: ( Uiviewcontroller *) Viewcontroller method can be
- (BOOL) Tabbarcontroller: (uitabbarcontroller *) Tabbarcontroller shouldselectviewcontroller: ( uiviewcontroller *) Viewcontroller{ nslog (@ "--tabbaritem.title--%@", ViewController.tabBarItem.title) //Here I'm judging the title of the currently clicked Tabbaritem if ([viewcontroller.tabbaritem.title isequaltostring:@ "personal"]) { //If the user ID exists, the description is logged in if (user_id) { return YES; } else { //Jump to the login page hploginviewcontroller *login = [[hploginviewcontroller alloc] init]; // Hide Tabbar login.hidesbottombarwhenpushed = yes; [(( uinavigationcontroller *) Tabbarcontroller.selectedviewcontroller) pushViewController:login animated:yes]; return NO; } } else Return yes;}
IOS Development Click Tabbaritem Add whether Jump login page to judge