2

In my current view I have 7 different text fields. 1 of them has a UIPicker as its input by doing : self.pickerTextField.inputView = _thePicker;

My problem is this: For now all the text fields look the same, I have tried changing their configurations, and even adding a small arrow pointing down to the one with the Picker but it does not give me the look I am looking for.

This is what I have now:

enter image description here

& This is the "menu/ drop down" look that I am looking for: enter image description here

Like I said, I have tried adding arrow images and it just does't have that 3D look like the bottom picture does. Thanks for your help!

Edit: My question is not about the AccesoryView to add prev/ next/ done buttons. My question is about changing the actual TextField's appearance.

skywinder
  • 21,291
  • 15
  • 93
  • 123
vzm
  • 2,440
  • 6
  • 28
  • 47
  • the "look you are going for" appears to be in a UIWebView and is in fact a "dropdown menu". Only UIWebView opens "dropdown menus" as a UIPicker. – WrightsCS Jul 16 '13 at 00:24
  • I've seen it done without using UIWebView... I just can't figure it out... @WrightsCS – vzm Jul 16 '13 at 00:28
  • WIthout a UIWebView then you need to write a custom class, or search the net for one (I'm pretty sure there is an open source version of what you are looking for). – WrightsCS Jul 16 '13 at 00:41

1 Answers1

4

I have done what you are trying to do and used ActionSheetPicker. I extended it and added an ActionSheetMultiPicker, but it sounds like the single component would work for you.

This works really well and results in a nice ActionSheet style picker that is presented from the bottom.

Also, I used the following to set a current property that I then resigned first responder in the method that instantiated the ActionSheetPicker.

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    curTextUIObject = textField;
    return YES;
}

I then wired up the editingDidBegin to an IBAction for presenting the ASPicker:

- (IBAction)relationshipPickerButtonPressed:(id)sender {
    [curTextUIObject resignFirstResponder];

     [ActionSheetStringPicker showPickerWithTitle:@"Select Relationship"
                                             rows:self.relationshipsArray
                                 initialSelection:self.selectedRelationshipIndex
                                           target:self
                                    successAction:@selector(relationshipWasSelected:element:)
                                     cancelAction:@selector(actionPickerCancelled:) origin:sender];
}

This is what it looks like on the device (simulator): enter image description here

LJ Wilson
  • 14,445
  • 5
  • 38
  • 62
  • I appreciate your answer, I actually already have the pref,next, done buttons to move around, the the images I posted are to show the textfield's appearance, nothing to do with the picker, I appreciate you taking the time to try to help out! – vzm Jul 16 '13 at 00:55
  • oh great! I am new to iOS, this post Helped me. Thanks – Naveed Ahmad Jan 08 '15 at 13:28