Re: calling a function in one class from another
Re: calling a function in one class from another
- Subject: Re: calling a function in one class from another
- From: Graham Cox <email@hidden>
- Date: Fri, 6 Aug 2010 00:53:07 +1000
On 06/08/2010, at 12:42 AM, Geoffrey Holden wrote:
> If I have a class 'Foo' (containing the function 'Wabble'), which loads
> another class 'Bar', is it possible a function within 'Bar' to execute the
> 'Wabble' function within the calling class 'Foo'?
Yes, within Bar, you just have [theFoo Wabble];
The real question is, how does Bar have a reference to <theFoo>? Maybe Bar could have an IBOutlet to theFoo and you link it up in IB. Otherwise you need to set it up somewhere in your code.
There are many ways to establish a relationship between two objects, but an instance variable (ivar) or an outlet (which is just the same thing, but visible to IB) is straightforward.
--Graham
_______________________________________________
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