Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Kizmar

macrumors newbie
Original poster
Oct 28, 2010
22
0
New to iOS development...

I've created an EntityListViewController that I would like to use to display different lists based on a listType property of the view controller.

I'd like to use this view with a Tab Bar Control. So far I've managed to figure out that I need to use didSelectViewController in the app delegate, and I can tell which tab is active by inspecting the tag. Set an alert, it pops up when I select the tab I wanted the alert to pop on. Good... but...

My question is: At this point I should know which view controller is currently active. How do I now set the listType property while I'm still in the didSelectViewController method?

I'm a .NET developer, so my first instinct is to create an instance of EntityListViewController and set it to (EntityListViewController)viewController, but that doesn't work. :)

Just need to be pointed in the right direction here. Thanks.

This is what I'm referring to (for clarity):
Code:
// Optional UITabBarControllerDelegate method.
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
	
	// If this is tab 5, set the listType property of the viewController to XX 
	if (viewController.tabBarItem.tag == 5)
	{
		// Set a property of the currently selected view
	}
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.