How to switch views with animation - objective c

iphone, objective-c, uianimation, uiview, uiviewanimationtransition

Solution

After more thinking I found a solution, add another view as a container view for both table view and map view. This way i can do:

   [UIView transitionWithView:self.someContainerView
                     duration:1.0
                     options:UIViewAnimationOptionTransitionFlipFromLeft 
                     animations:^{
                         self.mapView.hidden   = !showingMapView;
                         self.tableView.hidden = showingMapView;
                     } completion:nil
    ];  

without flipping the toolbar

Problem

I have a viewController that has a tableView and a mapView, and only one is visible. I also have a toolbar with segment control with two buttons (list and map) How do I switch between the table view and the map view ? and it's important that the toolbar will stay locked without animating with the views.

Original source