2016-07-13 4 views
-1

Ich mache die Anwendung mit UIDatePicker für Zeitformat. Es arbeitet im 12hrs Format, wenn ich das iPhone Datum/Zeit zu 24h Format ändere, muss ich nur 12hrs Format anzeigen, nicht das 24h Format.Gibt es sowieso das 24h Format in UIDatePicker zu verstecken

Gibt es trotzdem das 24h Format zu deaktivieren?

+1

Diese Frage vor gefragt wurde: http://stackoverflow.com/q/11151187/ 1153630 –

+0

aber ich möchte das 24-Stunden-Format deaktivieren. – NewbieiOS

Antwort

2

Mit diesem Code für 12-Stunden-Format

NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"US"]; 
[self.datePicker setLocale:locale]; 

Verwenden Sie diesen Code für 24-Stunden-Format

NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"NL"]; 
[self.datePicker setLocale:locale]; 
+0

gibt es eine Möglichkeit, immer 12hrs Format anzuzeigen? – NewbieiOS

+0

@ user2384583 Dies wird immer 12 Stunden Format anzeigen. Hast du es versucht ? –

+0

Wenn ich das iPhone Datum/Uhrzeit zu 24 Stunden Format ändere, zeigt es nicht das 12hrs Format an. – NewbieiOS

Verwandte Themen