iOS Tutorial PageViewController

Discussion in 'iOS Tutorials' started by Erel, Oct 14, 2015.

  1. Erel

    Erel Administrator Staff Member Licensed User

    PageViewController is a pages controller (similar to NavigationController and TabBarController) that allows the user to switch pages with a swipe gesture. It is similar to B4A ViewPager.

    Using PageViewController is simple. You initialize the controller with the list or array of pages.
    The next step is to set it as the key controller:
    Code:
    Private Sub Application_Start (Nav As NavigationController)
       Page1.Initialize(
    "Page1")
       Page1.RootPanel.LoadLayout(
    "Layout1")
       Page2.Initialize(
    "Page2")
       Page2.RootPanel.LoadLayout(
    "Layout2")
       Page3.Initialize(
    "Page3")
       Page3.RootPanel.LoadLayout(
    "Layout3")
       PVC.Initialize(
    "pvc"Array(Page1, Page2, Page3))
       App.KeyController = PVC 
    End Sub
    Video example:



    The example project is attached.

    Note that there is no navigation bar. The title is made of a label.
     

    Attached Files:

  2. Cara Mac

    Cara Mac Member Licensed User

    PageViewController is not being recognized as a class, is there a missing file?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    I forgot to write that it is available in B4i v2.30+
     
  4. ilan

    ilan Expert Licensed User

    is it possible to limit one page to run only in landscape and the second page to run only in portrait??
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    No.
     
  6. ilan

    ilan Expert Licensed User

    ok thanx erel, is your answer related only to the PVC or there is no possibility to do that with b4i?
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    My answer was specific to PVC. However there is no good solution in iOS for automatic rotation of the screen so you shouldn't try to combine landscape only pages with portrait only pages. Start a new thread if you like to further discuss it.
     
  8. Rochow

    Rochow Member Licensed User

    Why toolbar with PageViewController does not work? the Toolbar is visible in the B4i-Bridge but not to run.
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    The navigation and toolbar bars are part of the NavigationController. When you set the KeyController to PVC you replace the NavigationController with a different controller that doesn't include these bars.
     
  10. Alberto Iglesias

    Alberto Iglesias Well-Known Member Licensed User

    Erel,

    When I put gestures in a SideMenuController works OK, but the MENU BUTTON (ONLY WHEN PAGE IS OPEN) this button dont work, I can't CLICK to close, but it's like he's disabled, simply not work.

    I try put add gestures like TAP and PINCH, but dont work!

    Can you help me?

    [​IMG]

    Thanks

    Alberto Iglesias
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    Alberto this is a community forum. Please don't limit your questions to a single member.

    How is this question related to PageViewController?
     
  12. Alberto Iglesias

    Alberto Iglesias Well-Known Member Licensed User

    OK...

    Because the SideMenuController use PageViewController, and I donĀ“t know if this problem is relative to PVC or SMC
     
  13. Erel

    Erel Administrator Staff Member Licensed User

    Did you add a PageViewController inside the SideMenuController?
     
  14. Alberto Iglesias

    Alberto Iglesias Well-Known Member Licensed User

    Now I use the original sample in the forum, like this:

    Code:
    smc.Initialize(pageMenu,  nc, Null)
    smc.OpenGesturesEnabled = 
    True
    App.KeyController = smc

    nc.ShowPage(pageInicial)
    nc.NavigationBarVisible = 
    False
    but I tried everything, the page that goes left (in this case the pageInicial) is only waiting for the gesture of pulling and "off" the events of that button and whatever else is on the pageview
     
  15. Erel

    Erel Administrator Staff Member Licensed User

    You are posting in the wrong place. Please start a new thread for each question.
     
  16. little3399

    little3399 Active Member Licensed User

    Hi
    I compile the demo project it can be running well in IOS 9.1, but in IOS 9.2 , it compile very well ,but seem can not running ! it is show like this :

    upload_2016-2-15_16-43-35.png can not left or right move ...
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    I tested it and it does work here with v9.2. Did it happen happen in debug or release mode?
     
  18. little3399

    little3399 Active Member Licensed User

    in release mode ...
     
  19. Erel

    Erel Administrator Staff Member Licensed User

    Were you using v2.50 BETA with a local builder? Make sure to update the local builder with the stable version.
     
  20. little3399

    little3399 Active Member Licensed User

    Hi , Erel
    I have update the local builder version to 2.5 release ...

    But it running result is the same as past ... #16 ...

    And I iphone 6 ios version was updated to 9.2.1 ...
     
Loading...