简体   繁体   中英

How to know if a user has changed tab?

I have a Tab Bar Controller which has some Navigation Controllers as children. Is it possible to find out when a user navigated away from certain Navigation Controller (as he switched to another tab) in form of a callback?

Whichever class is the Tab Bar Controller's delegate will get sent the following selectors:

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController

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