//定義兩個文本框
UITextField *textName;
UITextField *textSummary;
//點擊return 按鈕 去掉
-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
//點擊屏幕空白處去掉鍵盤
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self.textName resignFirstResponder];
[self.textSummary resignFirstResponder];
}
摘自 like7xiaoben