My google searches tell me that you should implement
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
from the UITextFieldDelegate protocol.
Have a look at this for more info.