iOS Question Adding Views to NavigationBar

narek adonts

Well-Known Member
Licensed User
Longtime User
Hi,

Could you advise the way to add Views (Searchbox, Segmented Control, Image instead of page title,...) to the Navigation Bar.
I think this is a thing that a lot of apps are doing.
Or the way to create your own Navigation Bar,

thank you

Narek
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can add custom views with BarButton.InitializeCustom.
For example the following code adds a TextField:
B4X:
Private Sub Application_Start (Nav As NavigationController)
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.Title = "Page 1"
   Page1.RootPanel.Color = Colors.White
   NavControl.ShowPage(Page1)
   Dim bb As BarButton
   Dim tf As TextField
   tf.Initialize("tf")
   tf.HintText = "Enter something"
   tf.SetLayoutAnimated(0, 1, 0, 0, 100, 30)
   bb.InitializeCustom(tf)
   Page1.TopRightButtons = Array(bb)
End Sub
You can always remove the navigation bar and add a regular panel instead.
 
Upvote 0
Top