0

In My app, I have an form with contains UITableView and inside UITableview I have place Mutiple UITextField and UITextView. Whenever i click on UITextfield or UITextView Keypad comes up.

I am able to move the TextFiled UP when user click on UITextField ones they want to enter the data.But i am now able to move the TextView up when user want to enter the data.

Following is my code:

-(void)viewDidLoad
{

    [[NSNotificationCenter defaultCenter] addObserver:self
    selector:@selector(keyboardFrameDidChange:)
    name:UIKeyboardDidChangeFrameNotification object:nil];

    [[NSNotificationCenter defaultCenter] addObserver:self
    selector:@selector(keyboardWillHide:)
    name:UIKeyboardWillHideNotification object:nil];

}

Can anyone help me out to move the UITextView UP above the keypad?

Thanks in Advance.

Jay Bhalani
  • 4,142
  • 8
  • 37
  • 50
Nilesh .S. Joshi
  • 567
  • 2
  • 9
  • 26
  • 2
    Possible duplicate of [How to make a UITextView move up when keyboard is present](http://stackoverflow.com/questions/18224161/how-to-make-a-uitextview-move-up-when-keyboard-is-present) – Anbu.Karthik Oct 29 '15 at 11:37

2 Answers2

0

You can use this library

https://github.com/michaeltyson/TPKeyboardAvoiding

It will handle with frame when show hide keyboard for uitextfiled and uitextView.

And you make sure you do like this:

Adding a "container" view in the case of a ScrollView with constraints set to the superview is also a good practice as follows: ViewController -> UIScrollView (TPKeyboardAvoidingScrollView) -> UIView (container for UI elements) -> UITextView. If you want vertical scrolling set the height constraint to be '>='.

vien vu
  • 4,277
  • 2
  • 17
  • 30
0

Use IQKeyboardManager to handle this problem.

Features:

1) CODELESS, Zero Line Of Code

2) Works Automatically

3) No More UIScrollView

4) No More Subclasses

5) No More Manual Work

6) No More #imports

And its available for both languages (Swift and Objective C)

BADRI
  • 643
  • 8
  • 26