iOS Question SafeArea Problem

kohlenbach

Member
Licensed User
Hi,
I have a fullsize panel with anchors (panelMain) which I resize. This works.
In the panelMain, I have 2 panels with anchors . Panel 2 on the right sight with the buttons (screenshot) is only shown a part
after resize. (screenshot 2)
What can I do ?


B4X:
Sub B4XPage_Resize (Width As Float, Height As Float)
    Dim r As Rect = B4XPages.GetNativeParent(Me).SafeAreaInsets
    
    PanelMain.SetLayoutAnimated(0, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)

End Sub
 

Attachments

  • 2025-09-10_16-47-55.png
    2025-09-10_16-47-55.png
    25 KB · Views: 27
  • WhatsApp Image 2025-09-10 at 16.57.25.jpeg
    WhatsApp Image 2025-09-10 at 16.57.25.jpeg
    40.6 KB · Views: 26

kohlenbach

Member
Licensed User
This works, but now my menu is not shown anymore.
WhatsApp Image 2025-09-11 at 19.36.05.jpeg
 

Attachments

  • WhatsApp Image 2025-09-11 at 19.36.33.jpeg
    WhatsApp Image 2025-09-11 at 19.36.33.jpeg
    42.9 KB · Views: 25
  • designer.png
    designer.png
    151.5 KB · Views: 25
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I now understand the issue. With this change root becomes a regular panel:
B4X:
    Root = xui.CreatePanel("")
     Root1.AddView(Root, 0, 0, Root1.Width, Root1.Height)

You need to create a separate layout with the menu items and load them to Root1. Or add it programmatically:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    #if B4A or B4J
        Root = Root1
    #else if B4i
        Root = xui.CreatePanel("")
        Root1.AddView(Root, 0, 0, Root1.Width, Root1.Height)
    Dim bb As BarButton
    bb.InitializeText("Setup", "Setup")
    B4XPages.GetNativeParent(Me).TopRightButtons = Array(bb)
    #end if
   Root.LoadLayout("MainPage")
End Sub

Private Sub B4XPage_MenuClick (Tag As String)
    Log(Tag)
End Sub
 
Upvote 0
Top