How to use NSLengthFormatter with NSTextField?

135 Views Asked by At

I am trying to figure out how to use NSLengthFormatter with NSTextField. The output should be with local unit but no unit is displayed. I tried to set formatter manually in code and setStringValue:@"22" but it has the same result. What am I doing wrongly?

Screenshot

1

There are 1 best solutions below

2
Willeke On

A formatter creates a textual representation of an object and the methods of NSLengthFormatter take a double. Try setObjectValue:@22.0.