The marked answer is not quite correct if you want to support the time format desired by the user.
If you set the picker locale to the default (that of the device) the picker will use the 12/24 hr format of that particular locale. In the US this would be 12hr and in the UK for example this would be 24hr.
However, if the user changes their device manually to 12/24 your picker will not use this style.
If your picker is only using time and not date+time you can resolve this using a couple of approaches:
- Detect if the device is 12/24 manually and then select locale en_US for 12hr and en_GB for 24hr.
- Don't set the locale, only set the timeStyle to NSDateFormatterShortStyle, this will automatically choose the time format selected from the device settings.
If you're using the date+time then you need to set a locale to that of the device to get the date in the right language and format but this will then ignore the time format set on the device.