iOS Question TabBar Controller and Multiple Pages (in different modules)

Erel

Administrator
Staff member
Licensed User
Complete example:

B4X:
'main
Sub Process_Globals
   Public App As Application
   Public NavControl As NavigationController
   Private Page1 As Page
   Public tbc As TabBarController
End Sub

Private Sub Application_Start (Nav As NavigationController)
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.Title = "Page 1"
   Page1.RootPanel.Color = Colors.White
   tbc.Initialize("tbc")
   Page2Module.CreatePage
   tbc.Pages = Array(Page1, Page2Module.Page2)
   App.KeyController = tbc
End Sub
B4X:
'Code module named Page2Module

Sub Process_Globals
   Public Page2 As Page
End Sub

Public Sub CreatePage
   Page2.Initialize("page2")
   Page2.RootPanel.Color = Colors.Red
   Page2.Title = "Page 2"
End Sub
 

Mike1970

Well-Known Member
Licensed User
Complete example:

B4X:
'main
Sub Process_Globals
   Public App As Application
   Public NavControl As NavigationController
   Private Page1 As Page
   Public tbc As TabBarController
End Sub

Private Sub Application_Start (Nav As NavigationController)
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.Title = "Page 1"
   Page1.RootPanel.Color = Colors.White
   tbc.Initialize("tbc")
   Page2Module.CreatePage
   tbc.Pages = Array(Page1, Page2Module.Page2)
   App.KeyController = tbc
End Sub
B4X:
'Code module named Page2Module

Sub Process_Globals
   Public Page2 As Page
End Sub

Public Sub CreatePage
   Page2.Initialize("page2")
   Page2.RootPanel.Color = Colors.Red
   Page2.Title = "Page 2"
End Sub
Very Helpful!
Thanks Erel
 
Top