开发者

UITextField Custom InputView - How do I get textFieldShouldReturn to fire?

开发者 https://www.devze.com 2023-04-06 07:46 出处:网络
I have created a custom inputView and have a Done button.Does anyone know how I can wire the done button up to work the same as a return key on the built in keyboard.

I have created a custom inputView and have a Done button. Does anyone know how I can wire the done button up to work the same as a return key on the built in keyboard.

I basically need to get the textFieldShouldReturn method to fire for a UITextField.

I know I can call resignFirstResponder on the textfield, but this does not fire the textField开发者_Python百科ShouldReturn method.


If it's a custom input view, and a custom "Done" button, why do you need to use the text field delegate methods? You can wire the done button to your own action.

If you have some common code in your textFieldShouldReturn method this could be moved out to another method which can be called from the delegate method and your new action.

0

精彩评论

暂无评论...
验证码 换一张
取 消