So I have UIPickerView as inputView for one of my text fields. It works perfectly: it slides up, as normal keyboard would, I can select an option and it will be populated in a text field.
The only problem is that I can directly edit the field, by typing into it. How to disallow this behavior? So that even cursor doesn't show up?
I've tried the:
- (BOOL)textFieldShouldBeginEditing:(UITextField*)textField
{
[self.datePick setHidden:NO];
return NO;
}
but in this case picker stops to work completely - it doesn't appear.
Thanks for your help!
I ended up doing the following:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if([textField isEqual:self.birthdayF] || [textField isEqual:self.genderF])
return NO;
return YES;
}
so the cursor is still there, but user can't type anything in.