tags:

views:

829

answers:

1

With regards to a NSMutableArray, what is the difference between removeObject: and removeObjectIdenticalTo:

The wording in the API Reference seems very similar:

rO: Removes all occurrences in the receiver of a given object

rOIT: Removes all occurrences of a given object in the receiver

What am I missing?

UPDATE: I mean, how would I choose between them.

+2  A: 

removeObjectIdenticalTo will remove the object that is being pointed to, removeObject will run a isEqual: on all items in the array and remove it if it returns true.

Edit:

You should use removeObjectIdenticalTo if you know you have the same object (like for NSViews or similar), and removeObject for strings and objects where it may not be the same object, but should be considered equal for practical purposes.

cobbal