Listening for a TabBar view change

I need to know that in evertime a specific tab in my tab is selected to set a specific BOOL . viewDidLoad does the network really get called every time / when I click on the tab - is there an alternative to this?

I need to know this in this view-view view.

+4
source share
2 answers

You may need one of the following:

  • UITabBarDelegate method - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item

  • UITabBarControllerDelegate - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController

+4
source

UITabBar does not load all view controllers at once - it loads the first. When you click the button on the tab bar, you load another controller.

To get the changes in the tab bar, you can add a delegate and implement:

 -(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {...} 
0
source

All Articles