iOS 中通过kvc 获取数组的均值、求和、最大最小值等
NSArray *values = @[@72, @78, @75, @70, @72, @73, @77, @78, @75, @70, @72, @73, @87, @78, @75, @70, @72]; NSNumber *avg = [values valueForKeyPath:@"@avg.self"]; NSNumber *sum = [values valueForKeyPath:@"@sum.self"]; NSNumber *max = [values valueForKeyPath:@"@max.self"]; NSNumber *min = [values valueForKeyPath:@"@min.self"];