ios - Performing valueForKeyPaths against multiple keyPaths -


let's have object number of properties , load 1000s of these objects array. next, perform series of valueforkeypaths against these properties:

result.property1 = [array valueforkeypath:@"@sum.property1"]; result.property2 = [array valueforkeypath:@"@sum.property2"]; result.property3 = [array valueforkeypath:@"@sum.property3"]; etc... 

summing these properties individually seems pretty inefficient. there better way besides fast enumerating on properties , summing them manually? i.e.

for(foo* foo in array) {     result.property1 += foo.property1;     result.property2 += foo.property2;     result.property3 += foo.property3; } 

kvc requires keys strings:

a key string identifies specific property of object. typically, key corresponds name of accessor method or instance variable in receiving object. keys must use ascii encoding, begin lowercase letter, , may not contain whitespace.

so answer far know unfortunately can't valueforkeypath: have manually or enumerate on it.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -