0
votes

How can i move the table cell up when the keyboard screen appears on the screen.

Thanks in advance.

2

2 Answers

0
votes

Check this answer from Xamarin Forums

Push view up on Keyboard active

0
votes

Here is a peace of code; I am using in my application. May be it can help you.

/*
 Function: Registers current class for receiving notification from keyboard
 */
        void registerNotification(CGRect bounds)
        {
            NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillShowNotification, keyboardWillShow);
            NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, keyboardDidShow);
            NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, keyboardWillHide);
        }
        void keyboardDidShow(NSNotification notification)
        {


        }
        void keyboardWillShow(NSNotification notification)
        {
            //TODO: find a scenario for this
            CGRect bounds = UIKeyboard.BoundsFromNotification(notification);
            moveView(bounds, notification);
        }
        void keyboardWillHide(NSNotification notification)
        {
            CGRect bounds = UIKeyboard.BoundsFromNotification(notification);
            moveView(bounds, notification);
        }
        /*
        Function: Generic function to move the view along with the keyboard 
        */
        void moveView(CGRect bounds, NSNotification notification)
        {
            UIView.BeginAnimations(string.Empty, System.IntPtr.Zero);
            UIView.SetAnimationDuration(0.3);
            //Your code to Move View
            SetNeedsDisplay();
            UIView.CommitAnimations();
        }