iOS - IBAction - 用户在哪个文本字段中输入
我的应用程序中有 2 个文本字段,它们都与我的“devTyping”IBAction 连接。 当“编辑更改”事件发生时,将调用此方法(我猜它是一个方法)。
我如何告诉我的方法,用户正在哪个文本字段中输入?
- (IBAction)devTyping {
NSLog(@"How to know in which text field the user is typing?");
}
I have 2 text fields in my app and both are connected with my "devTyping" IBAction.
This method (I guess it is a method) will be called when the event "editing changed" happens.
How can I tell my method, in which text field the user is typing?
- (IBAction)devTyping {
NSLog(@"How to know in which text field the user is typing?");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看这个问题,这应该与您所要求的内容相同:)
Take a look at this question, which should be an equivalent as to what you are asking :)
您可以这样声明该方法:
并在 Interface Builder 中为每个文本字段分配一个
标签
,它只是一个用于标识文本字段(或任何其他元素)的数字。You could declare the method like this:
And assign each textfield a
tag
in Interface Builder, which is just a number to identify the text field (or any other element).