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 Comment