iOS Question BarButton Changes Position Between Pages

mmieher

Active Member
Licensed User
Everytime I display a new Page, I call a routine that does this:
B4X:
Dim lbHamburger As BarButton = CreateFABarIcon(Chr(0xF0C9),"Left")
inParent.ToolbarButtons.Add(lbHamburger)

Public Sub CreateFABarIcon(text As String, tag As Object) As BarButton
    Dim bb As BarButton
    Dim b As Button
    b.InitializeCustom("BarButton", Colors.White, Colors.RGB(16,116,74))
    b.CustomLabel.Font = Font.CreateFontAwesome(32)
    b.CustomLabel.TextAlignment = b.CustomLabel.ALIGNMENT_LEFT
    b.Text = text
    b.Tag = tag
    b.SetLayoutAnimated(0, 1, 0, 0, 24, 24)
    bb.InitializeCustom(b)
    Return bb
End Sub
What is happening is that the first time the above is called, the button is aligned on the left. The second time, it moves to the right about 100px. The third time it goes back to the left. It keeps alternating like that.

Neither the b.CustomLabel.ALIGNMENT_LEFT or the SetLayoutAnimated seem to have any effect.
 

mmieher

Active Member
Licensed User
No I don't. Maybe I do not understand the Toolbar? It appears to be associated with a page, so I thought I have to rebuild it every time I display a page?
 

mmieher

Active Member
Licensed User
I changed code to display the toolbar from the Main module. Once I display a new Page, the Toolbar is still visible but my fontawesome icon is gone. Do I need to use Designer to add icon to every screen?
 
Top