In the 3rd inspector of default view controller in the class section select rootviewcontroller hence the default view controller inherits from the rootviewcontroller class. As usual you should find a default view controller generated by xcode.
Planning ahead a bit let s set storyboard ids in the identity inspector for each of the view controllers above.
Page view controller tutorial swift. Drag a page view controller from the object library into the storyboard. Self pageviewcontroller view frame cgrectmake 0 30 self view frame width self view frame size height 60. In this tutorial you are going to learn about the basics of uipageviewcontroller that let s you scroll or page through a set of uiviewcontrollers.
Select the controller and configure the controller as initial view controller. Set one of the view controller background colors to red and the other one to blue. Creating page view controller in storyboard.
Firebase authentication tutorial 2020 custom ios login page swift duration. Now we have this setup select the red view controller and in the identity inspector in the top right set the storyboard id to sbred. Now for the fun part let s create three view controller objects in main storyboard.
This is more a tutorial for myself than anything else since uipageviewcontrollers have a few quirks that i always have to remind myself of. You yourself are causing this to be true. 2 2 setup pageviewcontroller now select viewcontroller swift file and inherit uipageviewcontroller instead of uiviewcontroller.
Shift click on the table to see all objects at that position and select table view. Then add another view controller and put it in the same storyboard. Then select the page view controller in the attributes inspector in the top right change the transition style to scroll.
Create new ios project named uipageviewcontrollerdemo under single view application and select swift language. These will be used in code to instantiate the view controllers. Swift creating a custom view from a xib updated.
Your uipageviewcontroller s view is smaller than the screen it allows room at the bottom for the page control and the button and at the top for the nav bar. Those pages cannot be bigger than that view in other words they are inside the page view controller. And in the 3rd inspector of new view controller select the class as pagecontentviewcontroller which means the new view controller inherits from pagecontentviewcontroller.
These will eventually be scrolled through in the page view controller. This is very useful e g. Next select the main storyboard.
Managing view controllers with container view controllers duration. Similarly for the page content view controller create a new class under the uiviewcontroller and name it as pagecontentviewcontroller. Do the same thing for the blue view controller this time naming it sbblue.
If you want to build a. Leave it as it is. In the attributes inspector configure static cells for content to configure the table cells in the storyboard instead of writing code to provide the data.