Reputation: 6631
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.
Upvotes: 1
Views: 766
Reputation: 85542
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.
Upvotes: 4