• 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: interface builder and nsarraycontroller binding newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: interface builder and nsarraycontroller binding newbie question


  • Subject: Re: interface builder and nsarraycontroller binding newbie question
  • From: Ashley Clark <email@hidden>
  • Date: Thu, 30 Oct 2008 03:35:50 -0500

Hi!

On Oct 29, 2008, at 9:43 AM, Bob Henkel wrote:

Hello,

<snip>

What I want to do now is invoke a method on the object I have selected
in nstableview by clicking a third button labeled Random Salary which
will call the method giveRandomSalary that I created in my Employee
class. The job of this method is just to set the Salary to a random
value. My issue is how do I invoke the method for the Employee object
?  Hopefully I'm not to far off path with what I'm trying to do. Any
help would be great.

For this you'll need some controller object that you define that will manage the window. It could be your application delegate or a specific window controller. In either case, that controller will need to have an IBOutlet NSArrayController instance variable defined that you'll then use in IB to establish a link to the array controller you defined in your NIB.


something like:
IBOutlet NSArrayController *myArrayController;

You'll also then need to define an IBAction method for your button to call in that same controller.

something like:
- (IBAction)changeSalary:(id)sender;

Then in your methods implementation you can message the array controller to get its' selected objects and in turn issue the - giveRandomSalary method on those objects.

Most of this is covered in this section of the Cocoa Application Tutorial:

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/06Controller/chapter_6_section_1.html#/ /apple_ref/doc/uid/TP40000863-CH8-SW1


Hope that helps and good luck!

Ashley

_______________________________________________

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


References: 
 >interface builder and nsarraycontroller binding newbie question (From: "Bob Henkel" <email@hidden>)

  • Prev by Date: A way to disable all tooltips in an Application?
  • Next by Date: Re: Parsing xml files in Cocoa applications
  • Previous by thread: interface builder and nsarraycontroller binding newbie question
  • Next by thread: A way to disable all tooltips in an Application?
  • Index(es):
    • Date
    • Thread