简体   繁体   中英

view events not being called in UITabBarController

i've got a little problem with my custom UITabBarController class. My UICustomTabBarController is a subclass of UITabBarController . In my didSelectItem event I implemented the following code:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
    [self showActivityIndicator];
}

I my showActivityIndicator method I add a activity indicator to my current view. It works just fine. Now i would like to remove the activity indicator when the current view will disappear.

i found the following events:

-(void)viewDidDisappear:(BOOL)animated {
NSLog(@"hello");
}
-(void)viewWillDisappear:(BOOL)animated {
     NSLog(@"hello");
}
-(void)viewWillAppear:(BOOL)animated {
     NSLog(@"hello");
}
-(void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion  {
    NSLog(@"hello");
}

Unfortunately none of them are working. They are not being called. Am I doing anything wrong? Thanks for your help!

Is the delegate property for UITabBar is set in the .h file ? ?

ie <UITabBarDelegate,UITabBarControllerDelegate>

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM