开发者

UITabBarController - detect when tab is UNselected

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 BE开发者_开发技巧FORE the selection, so that I can tell the view controller to kill some things.


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜