• 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
NSArrayController: add an object without selecting?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArrayController: add an object without selecting?


  • Subject: NSArrayController: add an object without selecting?
  • From: Josh Burnett <email@hidden>
  • Date: Tue, 15 Nov 2005 18:33:11 -0500

I've got myself a bit of a sticky situation. I have what amounts to an array of arrays, so I'm using the standard set of two cascading NSArrayControllers, with the first being bound to my top-level array of objects, and the second being bound to the selection of the first. So far, so good.

The problem comes in when I try to add an object to the first array. If I use the handy addObject: method, the controller tries to be even more helpful by going ahead and selecting the new object, too. The thing is, I don't want it to, as that makes my second controller change to the newly added object. So, for now, I'm trying to make an end run around it by manually adding the object to the array, and bracketing this in (will/did)ChangeValueForKey: calls. I have the NSTableView associated with the first controller set to preserve the selection, which it does just fine.

Here's the rub: even though the selection isn't changing, the downstream array controller is re-loading its data, which has some side effects that I don't want. How can I avoid this re-selection?

On a side note, is there a way to make the default selection of an NSArrayController be empty?

Thanks,

Josh

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSArrayController: add an object without selecting?
      • From: Miguel Sanchez <email@hidden>
  • Prev by Date: Dictionary to an invisible file
  • Next by Date: Re: Dictionary to an invisible file
  • Previous by thread: Re: Dictionary to an invisible file
  • Next by thread: Re: NSArrayController: add an object without selecting?
  • Index(es):
    • Date
    • Thread