iOS Question Menu with logo file

Picon

Member
Licensed User
My goal is to position the png file (logo) on the left side of the menu, the title in the middle of the menu, and the "Settings" option on the right side of the menu bar.
in B4i in the designer I did this:
1762613988656.png



This way, my logo is completely shifted to the left, the "Word Word" page title is centered (not ideal), and the "Settings" option is on the right.
I know this is unprofessional, but unfortunately I don't know (and can't) achieve this result any other way, for example, from code.

I would be grateful for any advice.
 

Picon

Member
Licensed User
forum iOs.png


My goal is:
1. Logo - completely on the left
2. Title - centered
3. Settings - completely on the right.

Currently, to center the "Title," I use blanks (16x and 10x) for the .Text properties in Top Right #1 and #3 in Page Designer.
I placed the logo file in Top Right #5 as Image (in .Button Type)
 
Upvote 0

Picon

Member
Licensed User
I removed the spaces in the .Text property for Top Right #1 and #3.
Top Right #2 and #4 are set with Button Type as FLEXIBLE_SPACE.
I set a png file for Top Right #5. The result is visible in the attachment.
On the left side there is a fragment of the name of page 2: „iSm...”, użyty w kodzie:

B4X:
Page2.Initialize
B4XPages.AddPage("Page name", Page 2)

and I can't hide it in the menu bar.

Still, blank spaces inserted before the text only partially solve the problem – for a given screen width. For a tablet, the set number of spaces will no longer fit. Even with the LandscapeLeft position, the entire layout doesn't stay in place.

I don't think there's anything I can do to keep the logo on the left side regardless of other menu items, other devices, or screen orientations.
 

Attachments

  • forum iOs_01.png
    forum iOs_01.png
    23.8 KB · Views: 36
Upvote 0

Picon

Member
Licensed User
Hi,

in the project:
I modified the code in the Application_Start section:
B4X:
Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("1")
    NavControl.ShowPage(Page1)
                '    Page1.TopLeftButtons = Array( _
                '        CreateFABarButton(Chr(0xF054), "right") _
                '        ,CreateFABarButton(Chr(0xF053), "left") _
                '        ,CreateFABarButton(Chr(0xF00C), "v") _
                '        ,CreateFABarButton(Chr(0xF00D), "x"))
    Dim bb As BarButton
    bb.InitializeBitmap(LoadBitmapResize(File.DirAssets, "test.png", 64dip, 64dip, True), "logo")
bb.TintColor = Colors.ARGB(255, 16,55,113)
    Page1.TopLeftButtons = Array(bb)  
         
    NavControl.ToolBarVisible = True
End Sub

and I got the result I was looking for:
forum iOs_b.png



However, my project is based on "B4XMainPage", where in "B4XPage_Created" the code looks like this:
B4X:
Page2.Initialize
    B4XPages.AddPage("name of page", Page2)
    Public bb As BarButton
    bb.InitializeBitmap(LoadBitmapResize(File.DirAssets, "test.png", 64dip, 64dip, True), "logo")
    bb.TintColor = Colors.ARGB(255, 16,55,113)

page 2 is shown after meeting several conditions from another module, but when I want to refer to "TopLeftButtons":
B4X:
Page2.TopLeftButtons = Array(bb)

I get the red message: "Unknown member: topleftbuttons"

I don't know how to use the "TopLeftButton" if the pages are managed differently than in the case I managed to modify (see the beginning of the message).

Why is it okay in one case:
B4X:
Page1.TopLeftButtons = Array(bb)
and not okay in the other?
 
Upvote 0
Top