how can I convert a nsnumber into a float
I need to multiply the value of an nsnumber by a float but they are开发者_JAVA技巧 of course incompatible types. How can I cast the nsnumber to a float?
float result = [myNSNumber floatValue] * myFloat;
Please check the "Accessing Numeric Values" section from NSNumber class reference for converting to other types.
Like so:
float value = [someNSNumber floatValue];
精彩评论