I have multiple tabs that each does something that may interfere with stuff going on the other tabs if not stopped. In case a user forgets to turn off function in one tab before going to the next tab, I want to know if there is a way to run a block of code from the UIViewController when the user clicks the other tab in the UITabBarController.
I have multiple tabs that each does something that may interfere with stuff going
Share
You should implement
UITabBarControllerDelegateprotocol in the view controller that has access to the business logic of your stuff. So you can do something when a user tries to click another tab.It is very likely that you need to implement:
See documentations for UITabBarControllerDelegate.