• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bindings Blues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Bindings Blues (From: Mark Davis <email@hidden>)

  • Prev by Date: Getting error info when NSSocketPort initWithTCPPort fails
  • Next by Date: Re: mouse pointer for drag copy
  • Previous by thread: Bindings Blues
  • Next by thread: DVD Studio Pro
  • Index(es):
    • Date
    • Thread