开发者

Creating a drop-down list in iPhone app

When I click the button with an arrow symbol, the开发者_Python百科 list of items available should be displayed as a list. Could anyone help me with the code for developing this for an iPhone application?


UIPickerView is the correct control, the one that iOS users expect, and the control specified by the Apple iOS Human Interface Guidelines.

Even on a web page in Safari, wherever there would normally be a drop down a picker is displayed instead. Go with the picker if you at all can.


iPhone does not have a built-in dropdown / selection list. You need to implement this yourself. This link contains a similar implementation using table view.

EDIT: UIPickerView is another option as pointed in other answers. You should also consider this.


Does it have to be a drop down list? The standard here is to use a UIPickerView (especially on the iPhone) like Safari does whenever you have a drop down list. Not only is it standard, but it's way simpler than what I'm about to propose.

Well, if your answer is 'yes, it has to be a drop down list on the same screen', you're stuck implementing it yourself. This could be rather painful, but off the top of my head, your best bet would be to to create a UITableView (which will act as your PickerView) and create a custom UITableViewCell that only has a label (or maybe label + icon, or however you wish). Whenever the user presses your arrow (sic)sumbol, you display the view by either animating it in underneath the arrow or by just making it appear. Remember, you will have to have some controller acting as the UITableViewDelegate and UITableViewDataSource.

If your answer is 'no, that sounds complicated' go with the picker.


To answer the actual question though, there is a discussion here:

How to create a dropdown tableview like Vine App

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜