如何禁用UIDatePicker中的AM / PM [英] How to disable AM/PM in UIDatePicker
问题描述
如何在 UIDatePicker
中从代码/界面构建器中禁用或隐藏AM / PM?
How to disable or hide AM/PM in UIDatePicker
from code / interface builder?
在 UIDatePicker
中有24小时时间选择器模式。
请帮助
I want to have 24 hours time picker mode in UIDatePicker
.
Please help
推荐答案
根据文档,您应该能够设置 locale
属性的UIDatePicker到使用24小时格式的语言环境。
According to the documentation you should be able to set the locale
property of UIDatePicker to a locale that uses a 24 hrs format.
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"da_DK"];
[datePicker setLocale:locale];
[locale release];
唉,有一个错误导致模拟器和设备继续根据用户布局日期选择器国际偏好。
Alas there is a bug causing both simulator and device to continue to layout the date picker according to the users international preferences.
根据您的建议,您必须滚动您的获奖日期选择器才能显示24小时选择器。
As you suggest, you have to roll your won date picker to be able to display a 24 hrs picker.
这篇关于如何禁用UIDatePicker中的AM / PM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!