ios编程,收回键盘的两种方法


- (void)viewDidUnload

{

[super viewDidUnload];

// Release any retained subviews of the main view.

}

//点击屏幕空白view时触发的事件

- (IBAction)backgroundTap:(id)sender{

[nameField resignFirstResponder];//通知文本失去第一响应者状态

[numberField resignFirstResponder];

}

//点击return时触发的事件?

- (IBAction)textFiledReturnEditing:(id)sender {

[sender resignFirstResponder];

}