iosobjective-cnsformatter

Formatting volume and mass units


Is there any mechanism to convert volume or mass units into local format like NSDateFormatter for date formatting?


Solution

  • Not in iOS 7, but it's coming in iOS 8.

    According to NSHipster, there'll be a NSMassFormatter and an NSLengthFormatter, both of which you can use to get formatted strings from.

    In the meantime, you can use a third-party library like DDUnitConverter and convert the value to a string using NSNumberFormatter.