nsmutablearray float对象返回零

sam*_*n01 2 iphone xcode objective-c ios

在根模型中,我有:

[self.rPrices replaceObjectAtIndex:0
                        withObject:[NSNumber numberWithFloat:(float)nR4]]; 
NSLog(@"%.2f", [self.rPrices objectAtIndex:0]);
Run Code Online (Sandbox Code Playgroud)

rPrices在哪里NSMutableArray.

nR4不为零,但上面NSLog(...);显示为零.

谢谢

Pau*_*l.s 9

试试这个

NSLog(@"%.2f", [[self.rPrices objectAtIndex:0] floatValue]);
Run Code Online (Sandbox Code Playgroud)

或者只是将其打印NSNumber为对象

NSLog(@"%@", [self.rPrices objectAtIndex:0]);
Run Code Online (Sandbox Code Playgroud)