iPhone:用户以类似于 HTML 选择的方式选择选项的最佳方式?
我目前正在编写 iPhone 应用程序,我需要模拟 HTML 选择。
该应用程序是网络应用程序的一个端口,允许用户选择不同的测量单位。例如,用户可以选择“毫米”或“英寸”。这在 HTML 中很好而且简单,因为选择非常适合这项工作,但是我如何向 iPhone 应用程序的用户呈现这个选择,因为 UIKit 中没有选择这样的东西?
I'm currently coding an iPhone app and i need to simulate a HTML select.
The app is a port of a web application which allows the user to select different units of measurement. For example, a user can select 'Millimetres' or 'Inches'. This is nice and simple in HTML as a select is perfect for the job, but how do i present this choice to the user of an iPhone app as there is no such thing as a select in UIKit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最接近的选项(也是用于此类操作的标准选项)是 UIPickerView。
如果您需要示例代码,请参阅上述链接文档标题中的“相关示例代码”部分。
在演示方面,您可以使用 UIActionSheet 来呈现 UIPickerView - 在 添加 UIPickerView &操作表中的按钮 - 如何操作?
The closest option (and the standard one used for such things) is a UIPickerView.
If you're after sample code, see the "Related sample code" section in the header of the above linked document.
In terms of presentation, you could use a UIActionSheet to present the UIPickerView - there's a good question/answer already for this at Add UIPickerView & a Button in Action sheet - How?
您正在寻找 UIPickerView:
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIPickerView_Class/Reference/UIPickerView.html#//apple_ref/occ/cl/UIPickerView
You're looking for the UIPickerView:
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIPickerView_Class/Reference/UIPickerView.html#//apple_ref/occ/cl/UIPickerView