Slide in the second tab bar view by clicking on item in the first

Posted by Henrik Erlandsson on Stack Overflow See other posts from Stack Overflow or by Henrik Erlandsson
Published on 2010-05-24T15:38:56Z Indexed on 2010/05/24 15:41 UTC
Read the original article Hit count: 352

I have an app with three tabs that switch views instantaneously when the user taps them. The first view is a table view selecting which 'location type' to filter by, to only show those pins (add those annotations) to the second view, a MapView.

When a table cell is clicked, it switches instantaneously to the mapview, using this code:

self.tabBarController.selectedIndex=1;

However, I would like to do this with a slide-in-from-right animation, like the one you get when drilling down a hierarchy of table views.

I tried this:

[self.navigationController pushViewController:[self.tabBarController.viewControllers objectAtIndex:1] animated:YES];

which compiles without error or warning, but does not switch views.

How do I 'apply' a navigation controller 'onto' a tab bar controller? Or is there some way to select another viewcontroller and specify an animation?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uinavigationcontroller