When we develop the registration interface, the last few registration conditions are often easily obscured by the system pop-up keyboard, such as:
Can see, mailbox conditions are obscured, how to solve it? I calculated the offset by the agent of the Uitextfield:
-(void) viewdidload{[Super viewdidload];//do no additional setup after loading the view, typically from a nib. Self.emailTextField.delegate = self;} -(void) textfielddidbeginediting: (Uitextfield *) textfield{//1. Frame CGRect frame = Self.emailt to get the blocked mailbox TextField Extfield.frame; 2. Calculate the height (y-coordinate) of the bottom represented by the occluded TextField and the maximum height (y-coordinate) that can not be obscured by the keyboard int offset = FRAME.ORIGIN.Y + +-(self.view.frame.size . height-216); [UIView animatewithduration:0.3 animations:^{if (Offset > 0) {//Let the entire view offset the gap upward Self.view.frame = CGRectMake (0,-offset, Self.view.frame.size.width, self.view.frame.size.height); } }]; }-(void) textfielddidendediting: (Uitextfield *) textfield{[UIView animatewithduration:0.3 animations:^{ After editing is reset to the original Self.view.frame = CGRectMake (0, 0, self.view.frame.size.width, self.view.frame.size.height); }];}Result diagram: