• 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
Getting an array/tree controller to select newly added managed objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting an array/tree controller to select newly added managed objects


  • Subject: Getting an array/tree controller to select newly added managed objects
  • From: "Sean McBride" <email@hidden>
  • Date: Fri, 18 Apr 2008 17:54:59 -0400
  • Organization: Rogue Research

Hi all,

Consider an app that uses bindings and Core Data.  It has a tableview
bound to an array controller.  There is an 'Add' button that creates a
new entity to be shown in the table.  It could be implemented by:

1) sending add: to the array controller.
2) using a custom IBAction method that creates a new entity and adds it
to the managed object context.

#1 is nice because the array controller will automatically select the
newly added object (if selectsInsertedObjects is YES).  However, I find
myself often needing to use method #2 because I must supply some initial
data to create the new entity.  In that case, the array controller sees
the new entity but does not select it.

What is the "right" way to get it selected?  Should I just pass the new
NSManagedObject up to my view-controller and call
[theArrayController:setSelectedObjects:[NSArray
arrayWithObject:newManagedObject]]?  If so, how do I do it in the tree
controller case?  There is no setSelectedObjects:.

Thanks,

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Getting an array/tree controller to select newly added managed objects
      • From: Ron Lue-Sang <email@hidden>
  • Prev by Date: Re: Unregistering KVO observers
  • Next by Date: Re: NSTableView -editColumn:row:withEvent:select: question
  • Previous by thread: Re: Modal popup from command line tool or daemon?
  • Next by thread: Re: Getting an array/tree controller to select newly added managed objects
  • Index(es):
    • Date
    • Thread