1

I want to change the default transition of navigation controller i.e. FROM left to right TO right to left when pushing a view controller and when I press back button then again change the default transition of navigation controller i.e. FROM right to left TO left to right

self.navigationController?.pushViewController(currentViewController, animated: false)
Muneeb Rehman
  • 119
  • 1
  • 8

1 Answers1

1

use this code sample:

let transition = CATransition()
transition.duration = 0.8
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
transition.type = kCATransitionFromRight // kCATransitionFromLeft
self.navigationController?.view.layer.addAnimation(transition, forKey: nil)
self.navigationController?.pushViewController(currentViewController, animated: yes)
shalu tyagi
  • 148
  • 8