0

如何自定义 UIDatePicker 以仅显示时间?有一种显示日、月和年的现有模式,但我想去掉日部分。

4

1 回答 1

0

您可以在界面生成器中将模式设置为时间、日期、日期和时间,或倒计时。

在您想要的代码setDatePickerMode中,值是:

typedef NS_ENUM(NSInteger, UIDatePickerMode) {
    UIDatePickerModeTime,           // Displays hour, minute, and optionally AM/PM designation depending on the locale setting (e.g. 6 | 53 | PM)
    UIDatePickerModeDate,           // Displays month, day, and year depending on the locale setting (e.g. November | 15 | 2007)
    UIDatePickerModeDateAndTime,    // Displays date, hour, minute, and optionally AM/PM designation depending on the locale setting (e.g. Wed Nov 15 | 6 | 53 | PM)
    UIDatePickerModeCountDownTimer  // Displays hour and minute (e.g. 1 | 53)
};
于 2012-10-11T17:14:20.710 回答