使用文本框,每当我们点击虚拟键盘中的 Go 按钮时,我都会调用一个方法,任何建议如何
最佳答案
您可以使用以下方法捕获返回键:
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
/* call whatever methods you need */
return YES;
}
但首先,您的 View Controller 需要设置为 textField 的委托(delegate)。 https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html
关于objective-c - 触发 IBAction 或在虚拟键盘中点击 Go/Enter 按钮的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13235287/