如何获得UITextField Tap事件? [英] How to get UITextField Tap Event?

查看:106
本文介绍了如何获得UITextField Tap事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Tap上显示UIAlertView,或者在UITextField上显示IPad和IPhone。我做了一个IBAction并用UITextField的Tap Down事件附上它。

I am trying to show UIAlertView on Tap or Click of UITextField for both IPad and IPhone. I make an IBAction and Attach it with Tap Down event of UITextField.

但它不能正常工作,意味着并非总是如此,如果是iPhone而且不能在iPad的情况下工作

But its not working correctly, means not always, in case of iphone and not working in-case of iPad

- (IBAction) TopuchState
{
    //function code
}

请帮助我该怎么做。

推荐答案

尝试为特定文本添加目标字段开始编辑( UIControlEventEditingDidBegin ):

Try adding a target for when a particular text field begins editing (UIControlEventEditingDidBegin):

 [textField1 addTarget:delegate action:@selector(textField1Active:) forControlEvents:UIControlEventEditingDidBegin];

这篇关于如何获得UITextField Tap事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆