gpt4 book ai didi

iphone - nsmutablearray 浮点对象返回零

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:55:16 26 4
gpt4 key购买 nike

在我的根模型中:

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

其中 rPrices 是 NSMutableArray

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

谢谢

最佳答案

试试这个

NSLog(@"%.2f", [[self.rPrices objectAtIndex:0] floatValue]);

或者只是打印 NSNumber 作为一个对象

NSLog(@"%@", [self.rPrices objectAtIndex:0]);

关于iphone - nsmutablearray 浮点对象返回零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6635612/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com