iOS Question HeightChanged Keyboard

Lucas Eduardo

Active Member
Licensed User
Hello,
I am using this class from this thread https://www.b4x.com/android/forum/threads/b4x-cross-platform-chat-layout-example.112649/#content

I tryed to use the code to ajust the keyboard with a little modification and it worked in iPhone S6 but in iPhone 11 Pro did not. I don't undestand why this happen. Could someone help me?

B4X:
Public Sub HeightChanged (NewHeight As Int)
    Dim c As B4XView = CLV.AsView
    c.Height = NewHeight - pnlBottom.Height - pnlTopChat.Height
    CLV.Base_Resize(c.Width, c.Height)
    pnlBottom.Top = NewHeight - pnlBottom.Height
    ScrollToLastItem
End Sub

Private Sub MainPage_KeyboardStateChanged (Height As Float)
    If Height = 0 Then
        chat1.HeightChanged(pnlChat.Height)
        MainPage_Resize(MainPage.RootPanel.Width, MainPage.RootPanel.Height)
    Else
        chat1.HeightChanged(MainPage.RootPanel.Height - Height) 'can ignore safe area
        MainPage_Resize(MainPage.RootPanel.Width, MainPage.RootPanel.Height)
    End If
End sub

Private Sub MainPage_Resize(Width As Int, Height As Int)
    Dim r As Rect = MainPage.SafeAreaInsets
    pnlChat.SetLayoutAnimated(0, 0.1, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)
End sub


The only difference is that i have a panel in the top of page. You can see in the image bellow.
 

Attachments

  • image0.png
    image0.png
    75.8 KB · Views: 264

Lucas Eduardo

Active Member
Licensed User
Thank you for your reply. Yes, the example works.
The difference is the panel pnlTopChat
B4X:
c.Height = NewHeight - pnlBottom.Height - pnlTopChat.Height
 
Upvote 0
Top