iOS Question Resize page not working

Pooya1

Active Member
Licensed User
Hi
I use below code for change page panel
Page1.RootPanel.Height = 100dip
I use this code in Page1_Resize
but this code is not working and i cannot change height in iPhone x
Because when i use SafeAreaInsets,occur error that not found this method so i use below code
But i dont have problem in get real height and big problem is not change height

B4X:
Sub GetRealPageSize(Page1 As Page) As Rect
   
    Try
        Dim rect2 As Rect
        Dim height,width As Float
        Dim no As NativeObject = Page1.RootPanel
        Dim top = 0, left = 0 As Int
        height = Page1.RootPanel.Height
        width = Page1.RootPanel.Width

        no = no.GetField("safeAreaInsets")
        Dim matcher As Matcher = Regex.Matcher("\{(.*)\}", no.AsString.Replace(" ", ""))
        If matcher.Find Then
            Dim values() As String = Regex.Split(",", matcher.Group(1))
            top = top + values(0)
            left = left + values(1)
            height = height - values(2) - top
            width = width - values(3) - left
        End If
       
        rect2.Initialize(left,top,width,height)
       
        If rect2.Bottom = 0 And rect2.Top = 0 And rect2.Left = 0 And rect2.Right = 0 Then
            rect2.Initialize(0,0,GetDeviceLayoutValues.Width,GetDeviceLayoutValues.Height)
        End If
       
        Return rect2
    Catch
        Dim rect2 As Rect
        rect2.Initialize(0,0,Page1.RootPanel.Width,Page1.RootPanel.Height)
        Return rect2
    End Try
       
End Sub
Thanks
 
Top