开发者

Drop down list for iPhone application

How can I add drop-down list to my iPhone application via Interface builder in Xcode 4. I can't see开发者_如何学JAVA any object like drop-down list controller or something like that?


I belive the control you might want is the UIPicker (Here's an image, its at the bottom). This is the control that pops up when you select a dropdown list in safari on iOS. You can select it in the object picker in the interface editing area. There is no dropdown list controller as such, as far as I know.


You can use UIPickerView, but it sounds like your more likely after UIActionSheet which will show a number of buttons to choose from. If these don't meet your needs you can always roll your own custom views, but this is more work. Apple's provided UI components are a good start.

Note: there's no Interface builder way to create a UIActionSheet, you have to do it in code, but it's pretty straight foward (see RootViewController class files in this Apple sample code project).


create a button (like dropdown button) and when you click on that button call another viewcontroller which you want to display and add it as subview to the controller.


Gayan, I think your question is already answered. please check this How to create dropdown box?

And as TOm H and petert mentioned , I too believe that you need to use UIPickerView.


here is another way of doing it http://www.edumobile.org/iphone/iphone-programming-tutorials/a-simple-drop-down-list-for-iphone/

Or here is one not everyone knows: The action sheet is basically a drop down list if you think about it. And if you keep adding buttons to a UIActionSheet it ends up turning into a table. So just have your button call a UIActionSheet.

http://i.stack.imgur.com/hN8BM.png

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜