Where is the combobox object in interface builder?
Solution 1
Combo boxes are available only for Mac projects, not iOS projects, so you're getting the expected behavior. If you create a Cocoa application project and type combo in the object library's search field, the combo box and combo box cell objects should appear in the object library.
I'm surprised you were able to access a combo box in earlier versions of Xcode. I don't remember combo boxes ever being available in iOS projects.
Solution 2
Using a UIPickerView will probably get you far
Solution 3
It's easy to make a ComboBox lookalike. It consists of only three parts in InterfaceBuilder xib:
- A Label for holding the selected choice. I've made it with a white background to look like an input field.
- A graphic Button with an arrow
- A ListView
The ListView is normally invisible (setHidden:TRUE) and is placed over other items in this xib. A tap on the Button makes the ListView visible (setHidden:FALSE). At selection, didSelectRowAtIndexPath writes the selected string to the label and set ListView hidden.
Solution 4
I also needed a HTML select-like control (single-selection dropdown list) without breaking the XCode legacy GUI interface across past and future iOS releases.
I ended up coding DownPicker, a lightweight control which does just that combining UITextField
and UIPickerView
. It can be used either as custom control (UIDownPicker
) or also as control wrapper, upgrading any existing UITextField
.
Here's how it looks like:
For more info and download you can check this brief tutorial or the GitHub project page (both made by me - the project is open-source).
jedimariachi
Updated on November 03, 2020Comments
-
jedimariachi over 3 years
I just updated to Xcode 5.0.2 and in interface builder on the lower right corner where I can drag and drop objects I don't see combobox any more. I tried using the search field below and typed combobox, NSCombobox, but nothing.
-
jedimariachi over 10 yearsYou're right. Is there anything like comboBox for iphone projects?
-
Swift Dev Journal over 10 yearsI don't know of any combo box type of control for iOS, but you could read Apple's iOS Human Interface Guidelines to learn about all the controls that are available for iOS. The Human Interface Guidelines are part of Apple's iOS documentation, which you can read in Xcode.
-
jedimariachi over 10 yearsThanks for the input, I think I can use UIPickerView to do what I need.
-
Youssef Moawad almost 8 yearsI highly recommend DownPicker. Quick to set up and very easy and straightforward to use.