iphone:Date-and-time-pickers

出自UXGuide.net

跳转到: 导航, 搜索

请帮助我们修订和更新本文的译文部分

本文的译文部分可能是由多个贡献者提供或从不同的渠道收集,未经过最终审阅和整理,请您帮助我们一起修订和更新本文的译文部分。

日期时间选择器
Date and Time Pickers

A date and time picker gives users an easy way to select a specific date or time. A date and time picker can have up to four independent spinning wheels, each of which displays values in a single category, such as month or hour. Users flick or drag to spin each wheel until it displays the desired value beneath the clear selection bar that stretches across the middle of the picker. The final value comprises the values displayed in each wheel. Figure 9-2 shows an example of a date and time picker.

一个日期和时间选择器为用户选择特定的日期或时间提供了一种简单的方法。一个日期和时间选择器最多可以有4个独立的可旋转的轮子,每个轮子在一个单独的类里显示数值,比如月份或小时。用户以弹或拖动的方式旋转每个轮子,直到它在横跨选择器并位于选择器中间的选择栏下方显示所需的值。最后的值包括每个轮子中显示的值。图9-2显示了一个日期和时间选择器的例子。

Figure 9-2  A date and time picker
图9-2 日期和时间选择器

ui_datetimepicker.jpg

Use a date and time picker to allow users to avoid typing values that consist of multiple parts, such as the day, month, and year of a date. A date and time picker works well because the values in each part have a relatively small range and users already know what the values are.

使用日期和时间选择器,使用户避免了输入由多个部分组成的值,如一个日期包含日、月和年。一个日期和时间选择器运作良好因为在每一部分的值有一个相对小的范围,并且用户已经知道这些值是什么。

Depending on the mode you specify, a date and time picker displays a different number of wheels, each with a set of different values. The date and time picker defines the following modes:

根据你指定的方式,日期和时间选择器显示不同数量的轮子,每个含有一些列的值。日期和时间选择器定义了下列模式:

时间。时间模式包含显示小时和分钟数值的轮子,外加一个可选的轮子用于设定AM/PM。
日期。日期模式包含显示月份、日和年数值的轮子。
日期和时间。日期和时间模式包含显示日历日期、小时和分钟值的轮子,外加一个可选的轮子用于设定AM/PM 。这个是默认模式。
倒计时计时器。倒计时计时器模式包含显示小时和分钟值的轮子。你可以指定一个倒计时的总时间,最长时间为23小时和59分钟。

By default, a minutes wheel displays 60 values (0 to 59). However, if you need to display a coarser granularity of choices, you can set a minutes wheel to display intervals of minutes, as long as the interval divides evenly into 60. For example, you might want to display the quarter-hour intervals 0, 15, 30, and 45.

默认情况下,分钟轮子包含60个值(0到59)。但是,如果你需要显示的选择较粗粒度,你可以设置一个分钟轮显示的时间间隔为分钟,只要间隔均匀划分成60份。例如,你可能希望显示四分之一小时的间隔 0,15,30和45。

Regardless of its configuration, the overall size of a date and time picker is fixed, and is the same size as the keyboard. You might choose to make a date and time picker a focal element in your view, or cause it to appear only when needed. For example, the timer mode of the built-in Clock application displays an always-visible date and time picker because the selection of a time is central to the function of the Timer. On the other hand, the Set Date & Time preference (available in Settings > General > Date & Time, when you turn off Set Automatically) displays transient date and time pickers, depending on whether users want to set the date or the time.

无论它的配置如何,日期和时间选择器的整体大小是固定的,键盘大小也是一样的。你可以选择在视图中把你的日期和时间选择器作为焦点元素,或者让它在需要时再显示。例如,在内置的时钟定时器模式的应用程序总是显示一个可见的日期和时间选择器,因为时间的选择是定时器至关重要的功能。另一方面,日期和时间偏好设置(在设置>综合>日期&时间中,当你关闭自动设置的情况下)显示临时的日期和时间选择器,这取决于用户是否需要设置日期或时间。

To learn more about using a date and time picker in your code, see UIDatePicker Class Reference.

要了解有关在代码中如何使用日期和时间选择器的更多信息,请见 UIDatePicker 类型参考

个人工具
名字空间
变换
动作
导航
工具箱