0
我有核心数据与实体(扣除)它有三个属性第一个(deductionName)第二个(扣除状态),最后一个是(扣除额)。现在我如何在核心数据中获得SUM
我想获得的(deductionAmount)的总和,如果(deductionStatus)== 1
(deductionStatus)是一个布尔值。
return [[[self.fetchedDeductionData fetchedObjects] valueForKeyPath:@"@sum.deductionAmount"]floatValue];
' NSInteger x = [[self.fetchedDeductionData fetchedObjects] count]; float sum = 0;对于(int y = 0; y
NamshanNet
如果您不需要索引,for-in循环更快,则不要使用count和old for-loop遍历数组。 –