2012-02-26 70 views

回答

0

這是我會怎麼做:

標籤都文本框(或使用性能)

textField1.tag = 100; 
textField2.tag = 101; 

還設置他們的代表。

textField1.delegate = self; 
textField2.delegate = self; 

在.h文件中聲明你的類將實現UITextFieldDelegate協議

,並在.M

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField 
{ 
    if (textField.tag == 100) //you should use a constant instead of 100 
    { 
     //set a breakpoint here so you would know your typing the first textField 
     return YES; 
    } 
} 
+0

你是什麼意思是:在.h文件中聲明你的類實現UITextFieldDelegate協議 – Adeeb 2012-02-26 14:50:58

+0

@interface YourViewController:UIViewController Lucas 2012-02-27 14:36:56