UITabViewController Tab Identification
I have a simple iPhone app (modified from the UITabBarController project template) where each tab is a different set of data using the same view controller (similar to the iPod app).
So for example if each tab was a person's name and hitting it would display their friends. Then each tab would use the same view controller right?
My question now is how do I identify programmatically what tab just got pressed (and in what function) so I know to load the appropriate data. I see viewDidLoad called each time but h开发者_StackOverflowow do I know what tab?
UITabBarController has a selectedIndex
method which returns the index of the selected tab.
You can use UIToolbar instead. You can insert some UIBarButtonItems there. So you will know, what button has been clicked.
精彩评论