0

I know I can customize dismiss animation using the following code - Dismiss view controller with custom animation?

let transition: CATransition = CATransition()
transition.duration = 0.5
transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
transition.type = CATransitionType.reveal
transition.subtype = CATransitionSubtype.fromRight
self.view.window!.layer.add(transition, forKey: nil)
self.dismiss(animated: false, completion: nil)

However, there is only limited of CATransitionType. We would like to achieve the following set of animations

  1. Move the screen from top-y of screen to middle-y of screen.
  2. Transparent the screen from alpha 1.0 to 0.0
  3. Rotate the screen 45 degree by using bottom right screen as pivot

In Android, we can achieve such animations with the following outcome.

enter image description here

I was wondering, in iOS, is it possible to achieve the same outcome when dismissing a ViewController?

Cheok Yan Cheng
  • 48,324
  • 124
  • 436
  • 828
  • Yes, you can have arbitrary animations when showing / dismissing a view controller. Google "ios custom view controller animation" and go through some of the tutorials. Or e.g. https://stackoverflow.com/q/2215672/2442804 – luk2302 Jul 18 '21 at 09:32

0 Answers0