However, it produces different results on different iPhones.
iPhone 11
iPhone 8 with safe area insets code
iphone 8 without safe area insets code.
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
I don't use a safe region at all for the top value, only for the bottom.
Are there any problems when you set it to 0?
I also never resize the root panel, is there a reason for this?
I don't use a safe region at all for the top value, only for the bottom.
Are there any problems when you set it to 0?
I also never resize the root panel, is there a reason for this?
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
I'm not sure why the iPhone 8 behaves differently. This code seems to solve it:
B4X:
Dim r As Rect = B4XPages.GetNativeParent(Me).SafeAreaInsets
r.Top = Max(20, r.Top)
Root.SetLayoutAnimated(0, r.Left, r.Top, w - r.Right - r.Left, h - r.Bottom - r.Top)