# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1639745248 0 # Node ID c2387166a41430cf940503fef40d054ab6a1d480 # Parent 74b69da35e918b5801a2f67ec0a8e3bd2ec03a1f iOS: Improve the combobox. Trigger the input view when touching the combobox down arrow, instead of just setting up the custom (list) input view. If becoming first responder by some other means, switch back to the keyboard input view instead of our custom (list) based input view. diff -r 74b69da35e91 -r c2387166a414 ios/dw.m --- a/ios/dw.m Fri Dec 17 00:39:33 2021 +0000 +++ b/ios/dw.m Fri Dec 17 12:47:28 2021 +0000 @@ -2860,10 +2860,12 @@ } -(void)showPicker:(id)sender { + [self resignFirstResponder]; + pickerView = [[UIPickerView alloc] init]; [pickerView setDataSource:self]; [pickerView setDelegate:self]; - + /* If the text field is empty show the place holder otherwise show the last selected option */ if([[self text] length] == 0 || ![dataArray containsObject:[self text]]) { @@ -2879,7 +2881,6 @@ UIToolbar* toolbar = [[UIToolbar alloc] init]; [toolbar setBarStyle:toolbarStyle]; - [toolbar sizeToFit]; /* Space between buttons */ UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace @@ -2899,10 +2900,18 @@ action:@selector(cancelClicked:)]; [toolbar setItems:[NSArray arrayWithObjects:cancelButton, flexibleSpace, doneButton, nil]]; - + [toolbar sizeToFit]; + /* Custom input view */ [self setInputView:pickerView]; [self setInputAccessoryView:toolbar]; + [super becomeFirstResponder]; +} +-(BOOL)becomeFirstResponder +{ + [self setInputView:nil]; + [self setInputAccessoryView:nil]; + return [super becomeFirstResponder]; } -(int)selectedIndex { return selectedIndex; } @end