views:

450

answers:

1

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

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

I've also tried doing this with "Editing Did End" methods, but that didn't seem to work.

+4  A: 

To run a method when a tab is tapped (and I'm assuming you're referring to a standard UITabBar), just implement tabBar:didSelectItem: in your tabBar's delegate.

To run code when your application quits, implement applicationWillTerminate: in your app's delegate.

Ben Gottlieb
I've googled for all of this stuff. Is there a book or some online documentation that you use to find these methods?
rksprst
Just the built in documentation within Xcode.
Ben Gottlieb