Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How to disable or hide AM/PM in UIDatePicker from code / interface builder?

I want to have 24 hours time picker mode in UIDatePicker. Please help

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
624 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.

As you suggest, you have to roll your won date picker to be able to display a 24 hrs picker.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...