2010-11-29 31 views
1

在我的應用中,我需要在用戶輸入第四個字符後立即發佈uitextfield的值。 當用戶輸入第四個字符時,如何獲取uitextfield的值。 任何人都可以告訴我我該怎麼做?iphone中的UITextfield chacter限制

+0

該頁面要求您完成垃圾郵件調查。 – 2011-01-07 05:14:38

回答

0

設置的UITextField的委託向視圖控制器/文件的所有者和使用textViewDidChange委託方法。

- (void)textViewDidChange:(UITextView *)textView { 
    if ([textView.text length] == 4) { 
     // Your post action goes here, with the value being textView.text 
    } 
} 
0

u可以使用的UITextField委託方法 -

-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { 

只要用戶輸入字符調用..