The iOS keyboard blocks the input box and the input area is automatically moved up.
During iOS development, I encountered a problem about the keyboard shielding input box. After network reference and practice, I summarized the following: In the login window, two uitextfields, one user name and one password are placed up and down, placed at the bottom of the screen at 1/3. When you click the user name, the keyboard is automatically displayed, which blocks the solution of the input box: 1. BLoginViewController implements the UITextViewDelegate method to copy code 1 // implements the UITextFieldDelegate method. When the TextField is edited, that is, the keyboard pops up, the input box is automatically moved up to 2-(BOOL) usage :( UITextField *) textField {3 NSTimeInterval animationDuration = 0.30f; 4 [UIView beginAnimations: @ "ResizeForKeyboard" context: nil]; 5 [UIView setAnimationDuration: animationDuration] 6 float width = self. view. frame. size. width; 7 float height = self. view. frame. size. height; 8 // move up n units, set 9 CGRect rect = CGRectMake (0.0f,-130, width, height) according to the actual situation; 10 self. view. frame = rect; 11 [UIView commitAnimations]; 12 return YES; 13} copy code 2. Set proxy copy code 1-(void) viewDidLoad 2 {3 [super viewDidLoad] for the input box; 4 5 // status bar white font 6 [[UIApplication sharedApplication] setStatusBarStyle: Regular]; 7 8 UIColor * btnBgColor = [UIColor colorWithWhite: 1.0f alpha: 1.0]; 9 [_ buttonLogin setBackgroundColor: btnBgColor]; 10 11 // Add the proxy 12 _ textFieldUserName to the input box. delegate = self; 13 _ textFieldPassword. delegate = self; 14 15}