单位风格
将 unitStyle
设置为 .Default, .Abbreviated, .Full
之一:
formatter.unitStyle = .Full
var answer = formatter.stringFromDistance(distance)
// "150 feet"
formatter.unitStyle = .Abbreviated
answer = formatter.stringFromDistance(distance)
// "150 ft"
Objective-C
formatter.unitStyle=MKDistanceFormatterUnitStyleFull;
NSString *answer=[formatter stringFromDistance:distance];
// "150 feet"
formatter.unitStyle=MKDistanceFormatterUnitStyleAbbreviated;
NSString *answer=[formatter stringFromDistance:distance];
// "150 ft"