I'm trying to pass ProgressView a float from a calculation made in another class. I've tried passing it by converting it to a NSDecimalNumber but I can't get it back to a float again when it reaches the destination. There's got to be a better way than this.
A:
myUIProgressView.value = someFloat; // where someFloat is just type float between 0.0..1.0
Should work. If you're using an NSNumber
to hold the value, you can use [myNSNumber floatValue];
to get its float representation.
jbrennan
2009-09-24 00:58:01
Thanks, this has been driving me crazy. I had the first bit figured already although slightly different from yours… myUIProgressView.progress = someFloat; The second bit [myNSNmber floatValue] is exactly what I was looking for. Do you know why there is not an NSFloat available?
Jim
2009-09-24 12:05:49
I'm guessing `NSNumber` encompasses it. And because `NSDecimalNumber` is a subclass, it works too.
jbrennan
2009-09-24 13:25:58
For some reason I had problems passing it as an NSNumber it was expecting a NSDecimalNumber so I changed it. The problem I'm now having is that NSSortDescriptor won't sort these values correctly. It could be how I've declared in the datamodel. I've tried setting it here as a decimal, float, and integer all producing different results, none of them right
Jim
2009-09-24 16:27:11