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遍歷數組。 –