Re: interface builder and nsarraycontroller binding newbie question
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