1

In My app i need to post the value of uitextfield as soon as user enter the fourth character. how can get the value of uitextfield when the user enter the fourth character. Can any one tell me how can i do it?

PgmFreek
  • 6,374
  • 3
  • 36
  • 47

2 Answers2

0

u can use UITextField delegate method -

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

it calls whenever user enter char ..

iOSPawan
  • 2,884
  • 2
  • 25
  • 50
0

Set the UITextField's delegate to the view controller/file's owner and use the textViewDidChange delegate method.

- (void)textViewDidChange:(UITextView *)textView {
    if ([textView.text length] == 4) {
        // Your post action goes here, with the value being textView.text
    }
}
Matthew Frederick
  • 22,245
  • 10
  • 71
  • 97