0

I'm currently designing an app that pulls map data from a service and renders them as pins on the MKMapView. In addition, my application has been designed using storyboards where each scene is embedded within a navigation controller. The feature I'm working on requires me to give the user the ability to toggle between a map view and table view for a given result set. To provide this functionality I've included a bar button item in the toolBar which (when pressed) should flip the current view out and a second view in.

So far I've been trying to the following code but to no avail:

MapListViewController *map = [[MapListViewController alloc]init];
[UIView beginAnimations:@"flip animation" context:nil];
[UIView setAnimationDuration:3.0];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:map.view cache:YES];

[self.mapView removeFromSuperview];
[self.view addSubview:map.view];
[UIView commitAnimations];

I originally got this approach from here but it doesn't seem to be working for me.

A couple more things to note:

  • The flip view transition should only change the view currently displayed within the top and bottom navigation bars.

  • Presenting the new view modally isn't an option because I will lose site of my navigation controller.

  • The view/view controller responsible for displaying the result set in a list format (i.e. UITableView) is contained within a single xib file where as the rest of the application sits within a storyboard.

Question

What is wrong with my current implementation? How should it be modified?

Community
  • 1
  • 1
dpalmajr
  • 537
  • 3
  • 15

3 Answers3

3

I haven't used your method but I did implement flipping some views using a UIView class method. It was very easy and straightforward. Refer to the docs for other options.

[UIView transitionFromView:self.firstVC.view toView:self.secondVC.view duration:1.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:^(BOOL finished) {
    // add any completion code here if needed.
}];
HM1
  • 1,684
  • 2
  • 18
  • 25
0

Check this links may help you

Flip View Iphone

how to implement an iPhone view transition animation with both flipping and scaling?

Hope it helps you . Thanks!!

Community
  • 1
  • 1
Kiran
  • 339
  • 1
  • 14
0

Hi implementing some thing like this should help you

To Push use this..

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [navigationController pushViewController:viewController animated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:navigationController.view cache:NO];
    [UIView commitAnimations];

For Pop use this

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [navigationController popViewControllerAnimated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:navigationController.view cache:NO];
    [UIView commitAnimations];
J S Rodrigues
  • 471
  • 4
  • 8