I added a PickerView to an TextField, now I want to allow the user to tab on the selected row and then the item must show in the textfield und the pickerView must hide.
I try this but I does not work.
Any help here?
- (void)textFieldDidBeginEditing:(UITextField *)textField {
UIPickerView *pickerViewGeschlecht = [[UIPickerView alloc] init];
pickerViewGeschlecht.dataSource = self;
pickerViewGeschlecht.delegate = self;
UITapGestureRecognizer *myGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pickerTapped:)];
[pickerViewGeschlecht addGestureRecognizer:myGR];
self.txtGeschlecht.inputView = pickerViewGeschlecht;
}
- (void) pickerTapped:(UITapGestureRecognizer*)gestureRecognizer{
txtGeschlecht.text = ausgewaehltesGeschlecht;
}