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.
Asked
Active
Viewed 334 times
1 Answers
0
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
- 11,943
- 14
- 73
- 115
-
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 Sep 24 '09 at 12:05
-
I'm guessing `NSNumber` encompasses it. And because `NSDecimalNumber` is a subclass, it works too. – jbrennan Sep 24 '09 at 13:25
-
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 Sep 24 '09 at 16:27