简体   繁体   中英

how to give Page View Controller a “Cover Vertical” transition style

With a Navigation View Controller, I can give a "Cover Vertical" transition style animation. However, having trouble replicating that with a Page View Controller. The only options given in the story board are "Scroll" and "Page Curl". Is there a way to do this programmatically?

It looks a little bit tricky but it should work :

Create a UIViewController which will be a Container Controller. Add a UIPageControl where ever you want. Then programmatically add a UINavigationViewController as a child of the container and add its view to the view hierarchy. You can use instantiateViewControllerWithIdentifier: of the main storyboard and don't forget to set constraints to it if you're using AutoLayout. Use a delegate between the container and the UINavigationViewController or the parentViewController property of the UINavigationViewController to change UIPageControl when the user navigates in the UINavigationViewController.

UIPageViewController is good to do only one single thing. Most of the time I prefer using a custom container controller rather than using it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM