• 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: Call method from a different file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Call method from a different file


  • Subject: Re: Call method from a different file
  • From: Andrew Merenbach <email@hidden>
  • Date: Wed, 30 Aug 2006 22:03:33 -0700

Hi, Brian. If you want your table view (let's call it myTableView) to call a method in a different class (call it myOtherClass), I'd suggest hooking up myTableView's 'delegate' variable to myOtherClass. This can be done in Interface Builder, or can be done programmatically via [myTableView setDelegate:myOtherClass].

Then, from your -keyDown: (assume that myOtherClass has a class type of BAOtherClass): {
[(BAOtherClass *)[self delegate] performMyMethod];
}


Make sure to #import "BAOtherClass.h" into your table view subclass.

Cheers,
	Andrew

On Aug 30, 2006, at 1:33 PM, Brian Amerige wrote:

Hi all,

I've got a subclassed NSTableView, and I'm overriding the keyDown method. However, the method I want to call (when, for example, the enter key is pressed) is in a different file. (My AppController.m file). How would I call it from my subclass?

Thanks.
Brian Amerige
http://extendmac.com
http://cocoaforum.com


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40ucla.edu


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Call method from a different file (From: Brian Amerige <email@hidden>)

  • Prev by Date: Re: Removing/Adding views in drawRect:
  • Next by Date: Re: subviews question
  • Previous by thread: Re: Call method from a different file
  • Next by thread: Menu item loses selectedRow?
  • Index(es):
    • Date
    • Thread