views:

98

answers:

2

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!

+1  A: 

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

Marc W
+2  A: 

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.

zoul