Reputation: 163
One of the tab bar controller tabs in my iPhone app changes what it displays based on where the user arrived from (which other tabs). For example, if the tabs are A, B, C and D, the C tab will display a picture if the user was previously on tab A, but text if the user was previously on tab B.
I'm not sure how to implement this without subclassing the TabBarController (which Apple documentation discourages). TabBarController has a property for currently active controller, and a list of all controllers in the tab bar, but no way to see the 'tab bar controller traversion tree/stack', so to speak. Any thoughts?
Upvotes: 1
Views: 913
Reputation: 16701
Instead of subclass UITabBarController
you can set a delegate and keep track of the last selected view controller via
- (void)tabBarController:(UITabBarController *)tabBarController
didSelectViewController:(UIViewController *)viewController;
Upvotes: 1