Creating a drop down list

2019-07-04 04:41发布

问题:

I want to make a drop-down list from scratch. Can anyone please tell me how to do so?

回答1:

You would start with a UITextField and a button to look like a normal closed drop down list. Then when the button is clicked I would add a new view containing a small UITableView for the drop down part. It shouldn't be too hard. However I'd reconsider the need for a drop down box. Its just not something that you have room on screen for, and the UIPickerView is better suited IMHO. Now on the iPad they use a drop down similar to what I described above but it has enough room on the screen to make this practical.



回答2:

You can use a UIPickerView or a UITableView to have a functionality akin to drop down lists.