首页 > 代码库 > 响应键盘return事件

响应键盘return事件

//点击其他地方,键盘收起

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

{

    [super touchesEnded:touches withEvent:event];

    [self.viewendEditing:YES];

}

 //响应键盘return事件

- (BOOL)textFieldShouldReturn:(UITextField *)textField

{

    [textField resignFirstResponder];

    returnYES;

}