• 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: noob question regarding proxy object returned by -selection method of NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: noob question regarding proxy object returned by -selection method of NSArrayController


  • Subject: Re: noob question regarding proxy object returned by -selection method of NSArrayController
  • From: Ken Thomases <email@hidden>
  • Date: Sun, 29 Jun 2008 02:07:19 -0500

On Jun 28, 2008, at 12:43 PM, Stuart Malin wrote:

I have a button in the GUI that should cause various changes to the person selected in the table. In the method that is the target of the button's action, I need to get the selected Person object so I can operate on it.

I know I could use the -selection method of the NSController to get a proxy object, and then use -valueForKey: and -setValueForKey to operate on the object via the proxy. However, this puts the logic of the manipulations in my appController. I'd rather the collection of manipulations be in the Person class, (i.e., have instance methods in the Person class that update a person object).

If I do this (have the update logic in the Person class), then I can't use the proxy object returned by the -selection method of the NSController (because the proxy object doesn't respond to the methods of the backing class).

Have you considered binding the button's target to the array controller's selection, and putting the action methods on the Person directly? (You might need to use a model key path of "self" to get around the proxy-ness.)


Cheers,
Ken
_______________________________________________

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: noob question regarding proxy object returned by -selection method of NSArrayController
      • From: Stuart Malin <email@hidden>
References: 
 >noob question regarding proxy object returned by -selection method of NSArrayController (From: Stuart Malin <email@hidden>)

  • Prev by Date: Re: Garbage Collection woes...
  • Next by Date: Re: Garbage Collection woes...
  • Previous by thread: Re: noob question regarding proxy object returned by -selection method of NSArrayController
  • Next by thread: Re: noob question regarding proxy object returned by -selection method of NSArrayController
  • Index(es):
    • Date
    • Thread