How to scroll UITextField, UITextview in UITableView or in UIViewController when keyboard appears on the screen.
Asked
Active
Viewed 1,713 times
3
-
http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present – Sport Jan 31 '14 at 09:22
-
https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html look this also – Sport Jan 31 '14 at 09:23
2 Answers
3
I'm using IQKeyboardManager. In general it's as easy as adding [IQKeyBoardManager installKeyboardManager];
to a viewDidLoad
method.

kovpas
- 9,553
- 6
- 40
- 44
1
Just handle the textView
/textField
delegate methods and adjust your view frame accordingly.
You can also add all the controls inside a scroll view and then scroll up/down within the following delegate methods
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
scrollView.frame = CGRectMake(scrollView.frame.origin.x,
scrollView.frame.origin.y,
scrollView.frame.size.width,
scrollView.frame.size.height - 215 + dynamicHeight);
}
-(void)textFieldDidEndEditing:(UITextField *)textField
{
scrollView.frame = CGRectMake(scrollView.frame.origin.x,
scrollView.frame.origin.y,
scrollView.frame.size.width,
scrollView.frame.size.height + 215 - dynamicHeight);
}
You can also set notification to fire the -keyboardWillShow
and -keyboardWillHide
methods.
There are these 3rd party library availabe on github.
Just google it and you will find loads of them.

staticVoidMan
- 19,275
- 6
- 69
- 98

gaurish.salunke
- 1,059
- 10
- 18