1

I've just started to learn to code in Swift and in the process of building a restaurant iOS app.

I basically have a table view of restaurants with a Map button on the top right, embedded in the nav. When you click on it, I like the view to flip to reveal a map.

How do I go about doing this?

The push segue seems to fixate on a default animation.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Danny
  • 190
  • 1
  • 12

2 Answers2

0

Take a look at UIView.transitionFromView method. First you will have to build your map view in code. Assuming you have that already you do following thing:

    UIView.transitionFromView(self.view,
      toView: yourMapView,
      duration: someDuration,
      options: UIViewAnimationOptions.TransitionFlipFromLeft,
      completion: nil)

in your UITabBarItem action.

66o
  • 756
  • 5
  • 10
0

You can present the new view controller modally and set its modalTransitionStyle to . FlipHorizontal. For example:

let mapViewController = MapViewController()
mapViewController.modalTransitionStyle = .FlipHorizontal
self.presentViewController(newViewController, animated: true, completion: nil)
beyowulf
  • 15,101
  • 2
  • 34
  • 40