Re: NSArrayController selection bug?
Re: NSArrayController selection bug?
- Subject: Re: NSArrayController selection bug?
- From: Henrik Wittland <email@hidden>
- Date: Tue, 11 Nov 2003 09:14:04 +0100
Am 11.11.2003 um 03:18 schrieb mmalcolm crawford:
On Nov 10, 2003, at 2:49 PM, Jesse Grosjean wrote:
I've added an extra action to your test application ("remove UMA")
that
will show the problem. Add a few objects, and then, making sure that
the last object in the tableview is selected, click the new "remove
UMA" button. You should see an index of of bounds exception.
It appears that there is indeed a bug here -- if you haven't already,
Jesse would you please report it?
I would suggest, however, that given this the appropriate workaround
is (as originally suggested) to message the array controller:
[theArrayController removeObjectAtArrangedObjectIndex:0];
This does not exhibit the bug, does not subvert the API, and does not
require you to create copies of the array. YMMV.
But it breaks the separation between MODEL and VIEW in the MVC
paradigma.
It does not work if you are binding more than one NSArrayController to
your model.
In the actual implementation of the Controller Layer the
NSArrayController does not care
about the differences in
NSKeyValueChangeSetting,NSKeyValueChangeInsertion,
NSKeyValueChangeRemoval or NSKeyValueChangeReplacement.
So generating this different notifications is only usefull if you need
them in your on code.
The best way to go with this problem depends on how fast this thing
will be fixed by apple.
If you want to write a clean model (clean in the meaning of not mixing
with the view) which can live in the Controlller Layer for
a longer time and will not produce this Error
than you will have to use the array copy workaround.
mmalc
_______________________________________________
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.
_______________________________________________
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.