xcode 用于 <select> 菜单的 iPhone 滚轮选择器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12060498/
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
iPhone scroll-wheel picker for <select> menus
提问by tcd
I'm developing a UIWebView iPhone app and mobile website and within the app I have many <select>
menus that contain 100+ items each!
我正在开发一个 UIWebView iPhone 应用程序和移动网站,在应用程序中我有很多<select>
菜单,每个菜单包含 100 多个项目!
I was wondering if there is a way to break the <select>
menu into submenus in order to make it easier for iPhone users to make selections, ex:
我想知道是否有办法将<select>
菜单分解为子菜单,以便 iPhone 用户更轻松地进行选择,例如:
I have this for my database setup:
我的数据库设置有这个:
| Subcategory | Food |
--------------------------------------
|eggs and cheese |scrambled |
|breakfast cereal |frosted flakes |
|breakfast cereal |mini wheats |
|breakfast cereal |cherrios |
So each item has a "sub-category" and then the actual "food"
所以每个项目都有一个“子类别”,然后是实际的“食物”
I print that into dropdowns like this:
我把它打印成这样的下拉菜单:
<select class="breakfast">
<option value="100" rel="20">Breakfast Cereal (Frosted Flakes)</option>
<option value="200" rel="10">Breakfast Cereal (Cheerios)</option>
<option value="150" rel="25">Breakfast Cereal (Mini Wheats)</option>
<option value="300" rel="30">2 Eggs and Cheese (scrambled)</option>
</select>
And when I touch the dropdown on the iPhone to make a selection, all 4 options are listed in that scroll wheel UI that iPhone defaults to:
当我触摸 iPhone 上的下拉菜单进行选择时,所有 4 个选项都列在 iPhone 默认的滚轮 UI 中:
I would somehow like to set it up so that I can have 2 scroll wheels with the Subcategories on the left and then once you pick that, it gives you the options for "food" on the right, like this (but with only 2 wheels):
我想以某种方式设置它,以便我可以有 2 个滚轮和左侧的子类别,然后一旦你选择了它,它就会为你提供右侧的“食物”选项,就像这样(但只有 2 个滚轮):
This example would be a scroll wheel on the left with 2 options, Eggs and Cheese
and Breakfast Cereals
, then when the user touches Breakfast Cereals
, it would load the 3 cereal options into the scroll wheel picker UI on the right!
这个例子是在左滚轮与2个选择,Eggs and Cheese
并且Breakfast Cereals
,然后当用户触摸Breakfast Cereals
,它会加载3个谷物选项加入到右侧的滚轮拾取器UI!
This is a little complicated, but does anyone have experience with this, or is it even possible??
这有点复杂,但是有没有人有这方面的经验,或者甚至可能?
采纳答案by tcd
I solved my problem here: Add a search function to UIPickerView in Xcode, or open <select> menu in UITableView
我在这里解决了我的问题:在 Xcode 中向 UIPickerView 添加搜索功能,或在 UITableView 中打开 <select> 菜单
I filter the results outside of the app, through the website using jQuery.
我使用 jQuery 通过网站过滤应用程序之外的结果。