Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since iOS 3.2, <code>UITextField</code> supports the <code>inputView</code> property to assign a custom view to be used as a keyboard, which provides a way to display a <code>UIPickerView</code>:</p> <p>You could use the <code>inputView</code> property of the <code>UITextField</code>, probably combined with the <code>inputAccessoryView</code> property. You assign your <code>pickerView</code> to the <code>inputView</code> property, and, to dismiss the picker, a done button to the <code>inputAccessoryView</code> property.</p> <pre><code>UIPickerView *myPickerView = [[UIPickerView alloc] init]; //myPickerView configuration here... myTextField.inputView = myPickerView; </code></pre> <p>Like that. This will not give you a direct way to dismiss the view since your <code>UIPickerView</code> has no return button, which is why I recommend to use the <code>inputAccessoryView</code> property to display a toolbar with a done button (the bar is just for aesthetics, you might as well just use a <code>UIButton</code> object):</p> <pre><code>UIToolbar *myToolbar = [[UIToolbar alloc] initWithFrame: CGRectMake(0,0, 320, 44)]; //should code with variables to support view resizing UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(inputAccessoryViewDidFinish)]; //using default text field delegate method here, here you could call //myTextField.resignFirstResponder to dismiss the views [myToolbar setItems:[NSArray arrayWithObject: doneButton] animated:NO]; myTextField.inputAccessoryView = myToolbar; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload