I have a UITabBarController
, and one of the views I would like to display a startup message describing itself with directions (This is a view for selecting random sports teams). There would be a separate button on the navigation bar, which when pressed would populate the UIView
with a view about a random sports team. Press that button again, and a different team is displayed. So, let's say I go to a different item that's listed on the UITabBar
, and later return to this random view. I want the view to be the last sports team displayed, not the startup directions page. Does anyone have any suggestions as to how to implement this case?

- 2,485
- 3
- 28
- 46
-
Can you try make it simple what exactly you want, it's not clear or rather confusing. at least for me.;,, :( – k-thorat Jan 28 '11 at 21:07
-
I've edited this. Does it sound any clearer? – Apophenia Overload Jan 28 '11 at 22:02
1 Answers
Implement some algorithm to random the data to load in that view after u leave that view through viewDidDisappear method
EDIT: Scratch that, use UITabBarDelegate method. From what i understand you are trying to load a view differently every time the user pressed it.
-(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
This method is called when your tab bar item is pressed, you could check whether the tab bar item is the tab bar item you wanted then do some random number generation in that method and load the view probably from an NSArray containing the team objects using the random number. For more information, read up: http://developer.apple.com/library/ios/#documentation/uikit/reference/UITabBarDelegate_Protocol/Reference/Reference.html and Generating random numbers in Objective-C