//点击其他地方,键盘收起
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
[self.viewendEditing:YES];
}
//响应键盘return事件
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
returnYES;
}
原文地址:http://www.cnblogs.com/qianyindichang/p/3783835.html