views:

33

answers:

1

If you have 4 tabs, what is the best way to inform one of the view controllers that it has been "deselected". In other words, that another tab was selected?

I can't just use viewDidDisappear, because that may happen anyway. Is there another way for a view controller to know that it is no longer the active tab?

The TabBar delegate (didSelectViewController) tells me which was selected, but I need to know which tab was active BEFORE the selection, so that I can tell the view controller to kill some things.

A: 

There is a TabBar delegate method of shouldSelectViewController which gets called to ask permission to change the view controller and a UITabBarController property of selectedViewController or selectedIndex.

Would need to verify that selectedIndex or selectedViewController does not change until the shouldSelectViewController method returns though...

Jbonniwell