iOS Question How do I create two pages using a navigation bar and tool bar

davepamn

Active Member
Licensed User
Longtime User
Here is my Two page code
B4X:
Sub Process_Globals

'These global variables will be declared once when the application starts.

'Public variables can be accessed from all modules.

Public App As Application

Public NavControl As NavigationController

Private Page1 As Page

Private Page2 As Page



PrivatelblOutputAsLabel

End Sub

Private Sub Application_Start (Nav As NavigationController)

NavControl = Nav

Page1.Initialize("Page1")

Page1.Title = "Page1"

Page1.RootPanel.Color = Colors.green

NavControl.ShowPage(Page1)

Page1.RootPanel.LoadLayout("frmMain")



Page2.Initialize("Page2")

Page2.Title="Page2"

Page2.RootPanel.Color=Colors.red

Page2.RootPanel.LoadLayout("frmPage2")



End Sub



Private Sub Page1_Resize(Width As Int, Height As Int)


End Sub



Private Sub Application_Background


End Sub



Sub cmdPressMe_Click

lblOutput.Text="Hello World"

End Sub


Sub cmdPage2_Click

NavControl.ShowPage(Page2)

End Sub

How do I implement the toolbar?
 
Last edited:

davepamn

Active Member
Licensed User
Longtime User
How do I take the two page code and convert into a tabbar navigation
 
Last edited:
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
The code sample was easy to follow.

B4X:
sub Process_Globals
private Page 1 as page
private Page2 as page
private tabcontroller as tabbarcontroller

End Sub

Private Sub Application_Start (Nav As NavigationController)

TabController.Initialize("tc")

Page1.Initialize("Page1")

Page1.Title = "Page1"

Page1.RootPanel.Color = Colors.green

Page1.RootPanel.LoadLayout("frmMain")

Page2.Initialize("Page2")

Page2.Title="Page2"

Page2.RootPanel.Color=Colors.red

Page2.RootPanel.LoadLayout("frmPage2")

TabController.Pages = Array(Page1,Page2)

App.KeyController = TabController

End Sub

I noticed the font size is too small on the tab controller bar. How do I change the font size programmatically
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
B4X:
dim oTabBarItem as TabBarItem
dim bmp as bitmap
bmp.initialize(File.DirAssets,"page1.png")  'Where page1.png is 60x60 pixels
oTabBarItem.initialize("Page 1",bmp,bmp)

Page1.RootPanel.loadlayout("frmMain")
Page1.title="Page 1"
Page1.TabBarItem=oTabBarItem

Page2.Initialize("Page2")
Page2.RootPanel.Color=Colors.red
Page2.RootPanel.LoadLayout("frmPage2")
Page2.Title="Page2"
Page2.RootPanel.AddView(VideoView1.View,ImageView1.Left,ImageView1.top,ImageView1.Width,ImageView1.Height)
TabController.Pages = Array(Page1,Page2)

The Icon appears to large in the tabbarcontroller and I see the word that was on the tabbaritem
 
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
Here is the bmp that I am trying to display as a tabbaritem
 

Attachments

  • page1.png
    page1.png
    1.5 KB · Views: 203
Upvote 0

davepamn

Active Member
Licensed User
Longtime User
At 30x30, the image now fits in the tool bar, but the text in the image is not showing. I am using a 24 bit png
 
Upvote 0
Top