View Full Version : Metric information from the locale
Jul 16, 2008, 10:50 AM
I'm trying to extract the measurement system from the locale on the iPhone with kCFLocaleMeasurementSystem or kCFLocaleUsesMetricSystem. They keep coming back to me as non-metric, even though I've rebooted the phone into UK/English.
Does anyone know if these constants are working? Or maybe how to use them :rolleyes:
Jul 16, 2008, 11:04 AM
RTFM! I didn't see you needed to use CFLocaleGetValue to get at those constants. Very cool... You can even play with it in the simulator.
NSString *measurement = [[NSString alloc] init];
currentLocale = CFLocaleCopyCurrent();
usesMetric = CFLocaleGetValue(currentLocale, kCFLocaleUsesMetricSystem);
if (usesMetric == kCFBooleanFalse)
measurement = @"Miles";
measurement = @"Kilimoters";
Jul 18, 2008, 04:16 PM
I didn't know you could do that.
But I should point out that here in the UK, although we use the metric system for pretty much everything else, we still use miles, so it might be better to allow the user to set the units using a preference option.
Just a thought....