1

I have a NSSet of object from the same class and I want to get the property value for each object stored in the NSSet, do I always need to iterate through the NSSet ? Or can I somehow create another NSSet containing the properties of the objects only without iterating?

If I have a NSSet of strings, and I need to remove the same substring from all strings in the NSSet, do I need to iterate, or can I create another NSSet with the removed substrings in another way ?

thanks

4

1 回答 1

1

尝试调用你的NSSet 的 valueForKey:. 它返回集合中每个项目的一组属性。

这要求集合中的每个对象都符合 KVC。

于 2011-11-18T16:16:42.150 回答