I got a UITimePicker in my app, and I want to use it to select a certain number of hours and minutes after a user event. (for example 3 hours 15 minutes after 7PM) This is why I want to show the date in 24 hour format, otherwise the user might get confused.
Is there a way to force the timepicker to show 24 hour view, independent of the clock format for the locale? Or do I just pick another locale?
UIDatePicker *timePicker;
NSDateFormatter *timePickerFormatter;
[self.view addSubview:timePicker];
float tempHeight = timePicker.frame.size.height;
timePicker.frame = CGRectMake(0,150 ,self.view.frame.size.width , tempHeight);
timePicker.hidden = YES;
timePickerFormatter= [[NSDateFormatter alloc]init ];
[timePickerFormatter setDateFormat:@"HH:mm"]; //formats date for processing
Thank you!
Update: I found the answer like this:
timepicker.datePickerMode = UIDatePickerModeCountDownTimer;
This effectively accomplishes what I'm trying to do by displaying 0 to 23 hours and 0 to 59 minutes, no further customization required! Sorry for asking about the 24 hour format, this is what the Android app that I'm porting over was using!