Call a method when switchig views with UITabBar

Is there any way to automatically call a custom method when switching views usig a UITabBarController? Like, I want to he able to, when I set a NSString in one view in a UILabel, haave it automatically update a different label on a different tab with the same string. Thank you!

13.10.2009 19:30:33

Yes, take a look at the UITabBarControllerDelegate protocol. All you have to do is register your object as the tab bar delegate and implement the shouldSelect or didSelect callback (the didSelect would be better a better choice). The callback will get called each time the tab bar switches.

13.10.2009 19:33:46

Take a look at tabBarController:didSelectViewController: in UITabBarControllerDelegate. Implement that method in your delegate and do whatever updating you need to do in there.

13.10.2009 19:32:34