Amy Gibbs <h...@willowtreecrafts.co.uk> wrote:

> how do  
> I reference the Arrays/Array controllers in the code? 

>. I've  
> added a 'calculate' button, so now I just need to take the 2  
> properties from the selected product, do the maths, and set the cost
> property with the result.

Why don't use use bindings of the button ?
If you don't mind buttons then they offers bindings to whatever method
you wish and you can give any number you need of arguments to the method
as long as you can bind to them in your interface.
Your methode does not need to be an IBAction (can be void).

declare and implement something like
- (void)doMathWithCost:(NSNumber)*cost purchase:(NSNumber*)purchase{
        self.cost = cost/purchase;
}
in your XIB open the inspector on bindings you'll find there is "Action
Invocation" with Target and Argument
For the target you bind to the object that will bring to your method
(FileOwner ?) and for keyPath the name of the method with colons
doMathWithCost:purchase:
For the arguments you bind to your arrayController keyPath
selection.cost for the first argument, selection.purchase

That way you don't have to reference your arrayController in code.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to