#pragma mark UItextFieldDelegate
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { CGFloat height = self.view.frame.size.height; CGFloat offset = height - (_OtherTextField.frame.origin.y + _OtherTextField.frame.size.height + 216+100); if (offset<=0) { [UIView animateWithDuration:0.3 animations:^{ CGRect frame = self.view.frame; frame.origin.y = offset; self.view.frame = frame; }]; } return YES; } - (BOOL)textFieldShouldEndEditing:(UITextField *)textField { [UIView animateWithDuration:0.3 animations:^{ CGRect frame = self.view.frame; frame.origin.y = 0.0; self.view.frame = frame; }]; return YES; }
2,点击收起
[_OtherTextField resignFirstResponder];
原文:http://www.cnblogs.com/conan0919/p/5121729.html