Monday, January 9, 2017

How to set ios navigation view control animation direction to left/right or up/down

By default when using ios navigation view controller to manage several UIViewController using show segue, the default animation is left/right. However, in certain cases, it may make sense to change the animation direction to up/down.

It is possible to implement a custom UIStoryboardSegue to do so as mentioned in http://stackoverflow.com/questions/30763519/ios-segue-left-to-right

However, an easy way to change navigation animation direction from left/right to up/down is embedded each uiviewcontroller into its own UINavigationViewController, and you will get the up/down animation automatically. Note you will need to manually handle the back button on each UIViewController's navigation bar, so that it will unwind to the previous screen.

By the way, when using a single navigation view controller to manage several view controllers, you can only customize the navigation bar buttons title for the first view controller on storyboard, but not be able to do so for other view controllers. In order to customize the navigation bar items for other UIViewControllers from storyboard, you will need to drag and drop a navigation item (not navigation bar, as navigation bar is only for adding into UINavigationViewController) into the UIViewController from storyboard.

No comments:

Post a Comment