New to objective c and this maybe a simple error. I am trying to dismiss all 3 UITextField keyboard which i have for UIPickerView. Whereby the keyboard won’t appear only the picker view would be shown. I did some research but can’t figure it out. Here is the code for the .m file and it won’t work.
-(void)textFieldDidBeginEditing:(UITextField*)textField;
{
[textField resignFirstResponder];
modeArray = [[NSMutableArray alloc] init];
if(textField.tag==1){
[modeArray addObject:@" bus "];
[modeArray addObject:@" bus/mrt "];
tbMode.inputView = pickerView;
pickerView.hidden = NO;
}
else{
if(textField.tag==2){
[modeArray addObject:@" 300 "];
[modeArray addObject:@" 400 "];
[modeArray addObject:@" 500 "];
tbWalkDist.inputView = pickerView;
pickerView.hidden = NO;
}
else{
if(textField.tag==3){
[modeArray addObject:@" cheapest "];
[modeArray addObject:@" fastest "];
tbRouteOpt.inputView = pickerView;
pickerView.hidden = NO;
}
else{
pickerView.hidden=YES;
}
}
}
}
how should i dismiss the keyboard only showing the picker view? Using this line [textField resignFirstResponder]; can i use to dimiss the keyboard?
You need to delegate all your text fields to the viewController and then use the method;
Make sure you add the text view delegate protocol to your viewcontroller .h file