views:

56

answers:

1

Hello,

I need to detect change in NSArray object - that is if some object was added/removed to/from NSArray or was just edited in-place. Are there some integrated NSArray hash functions for this task - or I need to write my own hashing function for NSArray ? Maybe someone has different solution ? Any ideas ?

Thanks.

+2  A: 

You could use an NSArrayController, which is Key-Value-Observing compliant. Unfortunately NSArray is only KVC compliant. This way you can easily monitor the array controller's arrangedObjects property. This should solve your problem.

Also, see this question: http://stackoverflow.com/questions/477204/key-value-observing-a-to-many-relationship-in-cocoa

Greg Sexton
This will not tell you if an object is mutated while in the array, though. You'd need to observe every single element in the array.
Chuck