iOS Tutorial PageViewController

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:
B4X:
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.
 

Attachments

  • PageViewController.zip
    4.5 KB · Views: 1,476

ilan

Expert
Licensed User
Longtime User
is it possible to limit one page to run only in landscape and the second page to run only in portrait??
 

ilan

Expert
Licensed User
Longtime User
ok thanx erel, is your answer related only to the PVC or there is no possibility to do that with b4i?
 

Rochow

Member
Licensed User
Longtime User
Why toolbar with PageViewController does not work? the Toolbar is visible in the B4i-Bridge but not to run.
 

Alberto Iglesias

Well-Known Member
Licensed User
Longtime 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?

gesture.jpg


Thanks

Alberto Iglesias
 

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Now I use the original sample in the forum, like this:

B4X:
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
 

little3399

Active Member
Licensed User
Longtime 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 ...
 

little3399

Active Member
Licensed User
Longtime 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 ...
 
Top