在[NSNumber numberWithDouble:doubleVar]转换的NSMutableArray中检索双打

Geo*_*off 1 double objective-c nsmutablearray

我正在寻找可能是我新手问题的简单答案.我知道NSMutableArray只能保存对象,所以当我将double放入数组时,我使用了[myArray addObject:[NSNumber numberWithDouble:aValue]];转换方法.我现在需要做的是将值拉出来作为双倍并将它们平均.我相信我将使用快速枚举方法与FoR循环.

我只需要知道如何让以下工作.

double total;

total = [myArray objectAtIndex:i]
Run Code Online (Sandbox Code Playgroud)

BJ *_*mer 7

total = [[myArray objectAtIndex:i] doubleValue];
Run Code Online (Sandbox Code Playgroud)