iOS Question Adding Button to Navigation Bar

cbanks

Active Member
Licensed User
Longtime User
What is the code to add a button to the navigation bar? What does the sub look like when someone taps on the button in the navigation bar? Thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use the designer to add the bar buttons. It is simpler.

Code to add bar buttons:
B4X:
Private Sub Application_Start (Nav As NavigationController)
   NavControl = Nav
   Page1.Initialize("Page1")
   NavControl.ShowPage(Page1)
   Dim b1, b2 As BarButton
   b1.InitializeText("Button1", "Button1")
   b2.InitializeText("Button2", "Button2")
   Page1.TopLeftButtons = Array(b1, b2)
End Sub

Sub Page1_BarButtonClick (Tag As String)
   Log("BarButtonClicked: " & Tag)
End Sub
 
Upvote 0
Top