當Touch發生時,您能捕獲TextField事件嗎?到目前爲止,我沒有看到Touch事件被註冊到TextField。例如,執行touchesBegan for UITextField
* (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [event allTouches] anyObject;
if (touch view == TextFieldView) {
do somthing.....
}
這是一個僞代碼,我想要實現什麼是我想要的是,當用戶觸摸的文本字段一段時間被解僱的方法。 如果是,比如何?
對此有所啓發。
Thnx提前。
請更多代碼。使用touchesBegan運算符顯示類的@implementation - > @ end的相關位,以及您認爲Cocoa告訴Cocoa您想要調用touchesBegan方法的代碼行(例如創建文本字段?)。您可能還想閱讀關於如何將所有代碼格式化爲屏幕上的代碼的常見問題解答。更容易閱讀的問題更容易回答。 – martinr 2009-12-18 13:40:19
對不起,這是「touchesBegan方法」而不是「運營商」。並且其他人能否對UITextField是否可以分類是肯定的或否定的? – martinr 2009-12-18 13:43:15