iphone:Pickers
出自UXGuide.net
请帮助我们修订和更新本文的译文部分
本文的译文部分可能是由多个贡献者提供或从不同的渠道收集,未经过最终审阅和整理,请您帮助我们一起修订和更新本文的译文部分。
选取器
Pickers
A picker is a generic version of the date and time picker (see “Date and Time Pickers” for more information about this control). You can use a picker to display any set of values. As with a date and time picker, users spin the wheel (or wheels) of a picker until the desired value appears. Figure 9-7 shows a picker with a single wheel.
选择器是一个日期和时间选择器的一般版本(有关此控件的更多信息,见“日期时间选择器”)。你可以使用一个选择器来显示任何一组数值。用日期和时间选择器,用户通过旋转选择器的轮子知道自己期望的数值出现。图9-7显示了一个单轮选择器。
Figure 9-7 A picker as displayed in Safari on iPhone
图9-7 在iPhone上,显示在Safari浏览器中的选择器
As you decide whether to use a picker in your application, consider that many, if not most, of the values in a wheel are hidden from the user when the wheel is stationary. This is not necessarily a problem, especially if users already know what those values are. For example, in a date and time picker, users understand that the hidden values in the month wheel can only be numbers between 1 and 12. If you need to provide choices that aren’t members of such a well-known set, however, a picker might not be the appropriate control.
当一个轮子处于静止状态,它的大多数数值在用户默认状态下就是被隐藏的时候,你就应该考虑在你的应用中使用一个选择器了。这不一定是个问题,尤其是在用户已经知道这些数值是什么的情况下。例如,在日期和时间选择器中,用户知道,隐藏在月份轮子下的数值只能是介于1和12之间的这些数字。如果你需要提供的选择并不是那些用户本来就能知道的数值,这种情况下,选择器可能就未必是适当的控件。
If you need to display a very large number of values, you might want to list them in a table view instead of in a picker. This is because the greater height of a table view makes scrolling faster.
如果你需要显示的值非常大,你可能更适合用一个表格视图,而不是选择器。这是因为一个更长的表格视图使滚动速度更快。
If you need to provide context for a value in a picker, such as a unit of measurement, display it in the translucent selection bar horizontally across the center of the control. Do not display such labels above the picker or on the wheels themselves. For an example of the correct way to display labels, see the Timer function of the built-in Clock application, which displays “hours” and “mins” (or “min”) next to the values users select.
如果你需要在一个选择器里为一个值提供说明,如一个计量单位,那就显示在半透明的横跨控件中心的选择栏中。不要在选择器正上方或轮子里显示这种标签。关于正确显示标签的例子,参见内置时钟应用程序中的倒计时功能,在用户选择的值的旁边显示“时”和“分”。
As with a date and time picker, a generic picker can be visible all the time (as a focal point of your user interface) or it can appear only when needed. The overall size of a picker, including its background, is fixed, and is the same size as a keyboard.
同日期和时间选择器一样,一个通用选择器可以一直显示(作为用户界面的一个焦点),也可以只在需要时显示。一个选择器的总体大小,包括其背景,是固定的,与一个键盘的大小相同。
To learn more about using a picker in your code, see UIPickerView Class Reference.
要了解有关在代码中使用选择器的更多信息,请参见 UIPickerView 类型参考。