xcode 如何在iphone中制作组合框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8596157/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:48:16  来源:igfitidea点击:

How to make a combobox in iphone

iphoneiosxcodecomboboxuipickerview

提问by Tony

I am trying to make a combobox in ios following this link http://www.codeproject.com/KB/iPhone/iphonecombobox.aspx. But the click event (that shows the picker) seems to work sometimes and sometimes not. It looks like sometimes it just works in some regions of the control and not others.

我正在尝试按照此链接在 ios 中制作组合框http://www.codeproject.com/KB/iPhone/iphonecombobox.aspx。但是单击事件(显示选择器)似乎有时有效,有时无效。看起来有时它只适用于控件的某些区域而不是其他区域。

Any idea of what is wrong?

知道出了什么问题吗?

采纳答案by Tony

For some reason, the answer was using the textfield and image directly to the page instead of creating a view for the control and using that view N times.

出于某种原因,答案是直接在页面上使用文本字段和图像,而不是为控件创建视图并使用该视图 N 次。

回答by tacos_tacos_tacos

It's kind of hacky, but you can add a hidden UIControlaround the region of the ComboBox and then wire it up to the same IBActionor voidthat the existing ComboBox uses. For example, -(IBAction) showPickercould be the action of a new UIControlthat you add right around the region.

这有点棘手,但您可以UIControl在 ComboBox 的区域周围添加一个隐藏,然后将其连接到现有 ComboBox 使用的相同IBAction或相同的位置void。例如, -(IBAction) showPicker可能是UIControl您在该区域周围添加的新操作。

回答by Zaldy

I created a combobox api for iOS, hope this could be of any help: http://www.chupamobile.com/products/details/365/ZComboBox/

我为 iOS 创建了一个组合框 api,希望这能有所帮助:http: //www.chupamobile.com/products/details/365/ZComboBox/