最終更新:2017-07-26 (水) 05:15:00 (2437d)
UITextFieldDelegate textFieldShouldReturn:
Top / UITextFieldDelegate textFieldShouldReturn:
Asks the delegate if the text field should process the pressing of the return button.
例
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField { if (theTextField == self.textField) { [theTextField resignFirstResponder]; } return YES; }
UITextFieldでリターンキーを押したときの動作
return YESのとき
- IBActionでDid End On Exitがハンドルされているか?
- されている
- Editing Did Endが呼ばれる(キーボードが閉じる)
- されていない
- Editing Did Endは呼ばれない(キーボードが閉じない)
return NOのとき
- なにもおきない
メモ
- Did End On Exitをハンドルしない場合、UITextFieldDelegate textFieldShouldReturn:内でresignFirstResponderを呼び出すとEditing Did Endが呼ばれる(キーボードが閉じる)