iOS Question TimePicker only am/pm in designer?

ilan

Expert
Licensed User
Longtime User
when i add the timepicker in the designer can i switch between am/pm and 24h mode?

thanx
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It changes automatically based on the device locale. You can use JavaObject and set the view's locale to a different one: http://stackoverflow.com/questions/...-in-uidatepicker-on-the-basis-of-app-settings

Something like:
B4X:
Dim locale As NativeObject
locale = locale.Initialize("NSLocale").RuNMethod("alloc", Null).RunMethod("initWithLocaleIdentifier:", Array("en_US")) 'or en_GB
Dim no As NativeObject = DatePicker1
no.RunMethod("setLocale:", Array(locale))
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
thanks @Erel i saw also the same thread in stackoverflow

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

but i could not figure out how to implement it in b4i using javaobject but u used NativeObjetct that looks much simpler.

(i need to study how to use that nativeobject)
 
Upvote 0
Top