iOS Question Centering Buttons on Navigation Toolbar

cbanks

Active Member
Licensed User
Longtime User
What is the code to center buttons on the bottom navigation toolbar?
 

cbanks

Active Member
Licensed User
Longtime User
What is the code to make a button use the ITEM_FLEXIBLE_SPACE? I've added my buttons programmatically, but I'm not sure how to assign the ITEM_FLEXIBLE_SPACE.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The code below defines this ToolBar:
upload_2014-11-24_15-10-28.png

B4X:
' initialize the ToolBar buttons of page 2
Private Sub InitButtonsPage2
    ' we want an button 'Edit' on the left
    ' and a button 'Pages' in the middle of the screen
    ' dim and initialize the ToolBarButton list
    Dim lstToolBarButtons As List
    lstToolBarButtons.Initialize
  
    ' dim the Edit BarButton
    Dim btn As BarButton
    ' initialize the Edit button as a 'text button'
    btn.InitializeText("Edit", "Edit")
    ' add the button to the list
    lstToolBarButtons.Add(btn)
  
    ' dim an ITEM_FLEXIBLESPACE button to move the
    ' Pages button to the middle of the screen
    Dim btn As BarButton
    btn.InitializeSystem(btn.ITEM_FLEXIBLE_SPACE, "")
    lstToolBarButtons.Add(btn)

    ' dim, initialize and add the Pages BarButton
    Dim btn As BarButton
    btn.InitializeText("Pages", "Pages")
    lstToolBarButtons.Add(btn)

    ' dim an ITEM_FLEXIBLESPACE button to keep the
    ' Pages button in the middle of the screen
    Dim btn As BarButton
    btn.InitializeSystem(btn.ITEM_FLEXIBLE_SPACE, "")
    lstToolBarButtons.Add(btn)
    Page2.ToolbarButtons = lstToolBarButtons
End Sub
 
Upvote 0
Top