ios iPhone/iPad UI:寻求下拉控制

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6723437/
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-08-30 20:47:50  来源:igfitidea点击:

iPhone/iPad UI: seeking drop-down control

iosdrop-down-menuuipickerview

提问by P i

My universal app has a settings page, wherein the user must choose a theme from a dozen available themes.

我的通用应用程序有一个设置页面,用户必须在其中从十几个可用主题中选择一个主题。

Problem is, if I am using a picker-view, it takes up most of the screen on an iPhone.

问题是,如果我使用选择器视图,它会占据 iPhone 上的大部分屏幕。

I think what I want is something like your standard Windows drop-down menu, where it just displays on a single line the current selection, and clicking it expands into a scrollable list of possible items. Selecting an item collapses the list back into the original form.

我想我想要的是类似于您的标准 Windows 下拉菜单,它只在一行中显示当前选择,单击它会扩展为一个可滚动的可能项目列表。选择一个项目会将列表折叠回原始形式。

So my question is: What is my best method for handling this situation? Can anyone point me to pictures or code examples of how this situation is handled successfully?

所以我的问题是:处理这种情况的最佳方法是什么?谁能指出我如何成功处理这种情况的图片或代码示例?

EDIT: This is the behaviour I'm looking for:

编辑:这是我正在寻找的行为:

  • only the currently selected profile is displayed
  • when the user taps on this, it expands into a list
  • when the user selects an item (or taps outside of the view) it collapses back to its original form, now displaying the new selection
  • 仅显示当前选择的配置文件
  • 当用户点击它时,它会扩展为一个列表
  • 当用户选择一个项目(或点击视图外)时,它会折叠回原来的形式,现在显示新的选择

ie functionally equivalent to a dropdown.

即在功能上等同于下拉菜单。

采纳答案by P i

Firstly, this question is a duplicate of:

首先,这个问题是重复的:

(not much good) Picker view as subview

(不太好)选择器视图作为子视图

(same) How to make an iPhone dropdown-looking button

(同)如何制作一个 iPhone 下拉式按钮

(better) How to create drop down list box for an iphone app

(更好)如何为 iphone 应用程序创建下拉列表框

(even better) Creating a drop-down list in iPhone app

(甚至更好)在 iPhone 应用程序中创建一个下拉列表

(that last one links to some handy code)

(最后一个链接到一些方便的代码)

Secondly, Google image search for 'dropdown control iphone' restricting the image size to 320x480 shows how everyone is doing this.

其次,谷歌图像搜索“下拉控制iphone”将图像大小限制为 320x480 显示每个人都是如何做到这一点的。

Basically a picker view scrolls in from the bottom, the same way as the keyboard does.

基本上选择器视图从底部滚动,就像键盘一样。

enter image description here

在此处输入图片说明