Re: NSArrayController Funkyness
Re: NSArrayController Funkyness
- Subject: Re: NSArrayController Funkyness
- From: Herr Witten <email@hidden>
- Date: Sat, 31 Jan 2004 12:06:01 -0500
On 31 Jan 2004, at 10:37 AM, Shawn Erickson wrote:
>
[As we find out below it is because you did not know what they did nor
>
want them to do what they are designed to do. think about it... if you
>
send a removeObject:object to an array what should it do? remove the
>
first, second, or last one found, what should it consider to be the
>
first one, second, last, etc.]
This is from another thread:
>
> In this particular case, it's not the methods that are working
>
> incorrectly, but that your assumptions about how they should work
>
> that is wrong.
>
>
>
> They will match any object that responds affirmatively to isEqualTo:
>
> and remove it, thus removing both sets of objects (new and old).
>
>
I have a very pure understanding of how they work, but thanks for the
>
tips anyway. In line with this discussion, isEqual: uses the hash
>
method that should not be the same for a class [that inherits directly
>
from NSObject] which is instantiated anew but initialized from
>
unarchived data. Moreover, this is not a problem with "old" and "new"
>
objects, but is the case even when new objects are added to a
>
controller via the add or insert methods. Even when I rename an
>
already existing object to the name of another, the removeObject
>
methods will delete both. These objects are clearly not related.
>
>
More importantly, the standard remove... methods of which you spoke do
>
remove all instances of the given object, but these objects,
>
particularly the ones of which I latterly spoke, are not the same
>
object instances.
>
>
Furthermore, I get different behavior in my table when I remove
>
objects directly from the content as opposed to doing it from the
>
controller interface. This suggests that there is some extra stuff
>
going on behind the scene; special sequences in which my customizing
>
commands must be made further corroborate this belief. That is the
>
source of my trouble.
>
>
Therefore, it is not my understanding of the methods, but of the
>
internal workings that could have been better developed so as to allay
>
this misunderstanding.
>
>
>
>
> You can use indexes, and it doesn't require much work.
>
>
>
>
This is a very good tip, and in fact I have done so with another
>
method, but I should not have to use this procedure. I'm more
>
interested in finding the trouble now than I am in finding the fix.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.