Run the method with a tab switch or keep the focus of the UIViewController

I would like to run a method when the user switches to another tab or when the application is closed. Is there a way to do this from iphone sdk?

I tried looking for methods for view controllers and tab strips, but I didn't see any methods that seemed to do this.

I also tried to do it with Editing Finished methods, but that didn't seem to work.

+1


source to share


1 answer


To run the method when the tab is clicked (and I'm assuming you are referencing the standard UITabBar), just implement tabBar:didSelectItem:

in your delegate tabBar.



To run the code when your application exits, execute applicationWillTerminate:

in the application's dedet.

+4


source







All Articles