无论如何要在 UIDatePicker 中隐藏 24 小时格式
Is there anyway to hide the 24hrs format in UIDatePicker
我正在用 UIDatePicker
来申请时间格式。它以 12 小时格式工作,如果我将 iPhone date/time 更改为 24 小时格式,我只需要显示 12 小时格式,而不是 24 小时格式。
是否可以禁用 24 小时格式?
将此代码用于 12 小时格式
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"US"];
[self.datePicker setLocale:locale];
将此代码用于 24 小时格式
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"];
[self.datePicker setLocale:locale];
我正在用 UIDatePicker
来申请时间格式。它以 12 小时格式工作,如果我将 iPhone date/time 更改为 24 小时格式,我只需要显示 12 小时格式,而不是 24 小时格式。
是否可以禁用 24 小时格式?
将此代码用于 12 小时格式
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"US"];
[self.datePicker setLocale:locale];
将此代码用于 24 小时格式
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"];
[self.datePicker setLocale:locale];