简体   繁体   中英

How can I change normal ViewController to PageViewController?

my project starts in a normal ViewController now I want to use Push segues but that only works with a PageViewController . Now how can I change my ViewController with .h and .m with code in it to a PageViewController

I think you're getting a little confused about what PageViewController is. If you want to Push segues your view controller must be inside of a UINavigation Controller. You will init your first view controller as the root view controller and then you will be able to "push" on top of the navigation stack. No PageViewController needed.

Your premise is incorrect.

PageViewControllers don't handle push segues, navigation controllers do.

A page view controller manages a series of pages. It is kind of like a table view or collection view, except that the contents are full pages, and use either a page curl or side-scroll animation between pages.

A navigation controller manages a stack of view controllers and you use push and pop commands to add view controllers to the stack or take them off the stack.

If you want to put your app's current view controller inside a navigation controller, there is a menu command for that in Interface Builder. Select the view controller, pull down the edit menu, and look for "Embed in>Navigation Controller." If you select that menu item, Interface Builder will wrap the selected view controller inside a navigation controller. I think that's what you want.

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