• 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: calling a function in one class from another
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >calling a function in one class from another (From: Geoffrey Holden <email@hidden>)

  • Prev by Date: Re: Resolution of an NSImage(Rep)?
  • Next by Date: Re: Resolution of an NSImage(Rep)?
  • Previous by thread: calling a function in one class from another
  • Next by thread: Re: calling a function in one class from another
  • Index(es):
    • Date
    • Thread