Move UITextFields when keyboard opens in iPhone app

While working on my latest app, I was looking for a solution to slide the screen up when the keyboard opens so that text fields aren’t hidden by it.

I came across this one: TPKeyboardAvoiding its a very simple drop in component. You copy a couple classes into your existing project, put all your elements into a scroll view with the class TPKeyboardAvoidingScrollView and call a simple method and you are done.

-(void)textFieldDidBeginEditing:(UITextField *)textField
[scrollView adjustOffsetToIdealIfNeeded];

Thanks to this article I was able to find this solution.

Leave a Reply

Your email address will not be published. Please enter your name, email and a comment.

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>