I have a scanner that is reading text into a UITextField, looks like it is one character at a time. So every 1/2 second or so I want to check the value of that UITextField so I can grab the value.
Two options:
1) Set the text field's delegate, then catch the changes as they happen in the shouldChangeCharactersInRange method of said delegate.
2) Use an NSTimer object.
In most situations, the first method is superior, but if you want to check every so often rather than catching the changes as they happen, you will need the NSTimer.
I think there is a better method than the ones William stated, although both will work.
The best option would be to set the UIControlEventEditingChanged event to an action. For example:
[textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
This will call the method:
- (void)textFieldDidChange:(id)sender { }
everytime that the text field changes. Make sure you also declare the method in your interface. The statements that you put in between the { } (curly brackets) will be performed for every change in text.
If however you do really want to check the value of the text box periodically and not just on change, you can use the following code:
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(textFieldDidChange) userInfo:nil repeats:YES];
-Dan