iOS Question B4xpages - Odd Behaviour of safe area insets

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
I am using the code for safe area insets: https://www.b4x.com/android/forum/t...or-managing-multiple-pages.118901/post-746585
on b4xpages.

However, it produces different results on different iPhones.

iPhone 11
1654093525535.png


iPhone 8 with safe area insets code
1654093597804.png


iphone 8 without safe area insets code.

1654093797853.png



Any idea what is going on?

B4X:
private Sub b4xpage_resize(w As Float, h As Float)
       #if B4i
    Dim r As Rect = B4XPages.GetNativeParent(Me).SafeAreaInsets
    Root.SetLayoutAnimated(0, r.Left, r.Top, w - r.Right - r.Left, h - r.Bottom - r.Top)
    #end if
End Sub
 

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
tried this.
B4X:
private Sub b4xpage_resize(w As Float, h As Float)
       #if B4i
    Dim r As Rect = B4XPages.GetNativeParent(Me).SafeAreaInsets
    Root.SetLayoutAnimated(0, r.Left, 0, w - r.Right - r.Left, h - r.Bottom)
    #end if
End Sub

unfortunately it looks the same as the iphone 8 with insets
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
I turn off the standard Nav bar.

B4X:
#if b4i
    Main.NavControl.NavigationBarVisible = False
#end if

Here is a sample project that demonstrates the issue.

I have tried it on Apple phones with buttons , iPhone 8 this show the problem, and without button, iPhone 11, which is fine.
 

Attachments

  • safearea.zip
    70.2 KB · Views: 91
Upvote 0
Top