Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch views with animation - objective c

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.

like image 537
Eyal Avatar asked Apr 21 '12 07:04

Eyal


1 Answers

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

like image 179
Eyal Avatar answered Oct 03 '22 11:10

Eyal