When I push or pop a UIViewController, how long does the animation takes to complete the slide animation. I have a view on the main window, which I need to slide in sync when a ViewController is pushed or popped.
Does anyone has any idea on the type and duration of animation that takes place when I push or pop a view.
Thanks in advance.
popViewController(animated:)Pops the top view controller from the navigation stack and updates the display.
You can do it by selecting the View Controller in Storyboard editor and clicking Editor -> Embed In -> Navigation Controller. Also make sure that you have your Storyboard Entry Point (the arrow that indicates which view controller is presented first) either pointing to Navigation Controller or before it.
Almost all animations in the iPhone are 0.3 seconds.
In iOS 7 and later you can have exact value by setting the UINavigationController
delegate and using the method:
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated {
NSTimeInterval duration = [viewController.transitionCoordinator transitionDuration];
}
This is future proof method if the defult duration will ever change. At the moment it's value is 0.35 second.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With