开发者

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];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜