Re: Bindings Blues
Re: Bindings Blues
- Subject: Re: Bindings Blues
- From: mmalcolm crawford <email@hidden>
- Date: Thu, 29 Jul 2004 11:36:05 -0700
On Jul 29, 2004, at 7:00 AM, Mark Davis wrote:
My application controller is holding an array _groups. Each group in
the _groups array has a contents array which holds all the objects
stored inside the group.
So when I went to remove an object from one of my groups I simply did
this:
[self willChangeValueForKey:@"groups"];
[[[[self groups] objectAtIndex:[groupTable selectedRow]] contents]
removeObjectAtIndex:[contentsTable selectedRow]];
[self didChangeValueForKey:@"groups"];
[...]
Whenever I remove the last object in the contents I get an error:
*** -[NSCFArray objectAtIndex:]: index (0) beyond bounds
For some reason that sounds like a known problem, although I can't
remember the details.
That said, what's the context? Do you need to manipulate the array
programmatically here, or can you just connect a button to the array
controller's remove: action? If you can't do that, a workaround (that
also tests for a valid selection) might be to message the array
controller directly:
if ([arrayController canRemove])
{
[arrayController remove:nil];
}
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.