• 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: Simple Newbie Question on Calling a Method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple Newbie Question on Calling a Method


  • Subject: Re: Simple Newbie Question on Calling a Method
  • From: mmalcolm crawford <email@hidden>
  • Date: Sat, 20 Dec 2003 12:59:12 -0800

On Dec 20, 2003, at 12:17 PM, Jerry Krinock wrote:

in Controller.h:
@interface Controller : NSObject
{
IBOutlet id sorterWindow ;
... // other outlets
}
- (void) bringSorterWindowToFront;
... // other method declarations
@end
in Controller.mm:
@implementation Controller
- (void)bringSorterWindowToFront
{
[sorterWindow makeKeyAndOrderFront: self];
}
.. // other method definitions
@end
in another .mm file, I call my function with the message:
[Controller bringSorterWindowToFront] ;
Result: It compiles OK, but upon running, I get:

No compiler warnings...?

You're sending the message to the class (Controller) not an instance.

<http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ 3objc_language_overview/chapter_3_section_4.html>

You'll need means of accessing the relevant instance of Controller from your other object -- typically through an outlet (instance variable).

mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Simple Newbie Question on Calling a Method
      • From: Jerry Krinock <email@hidden>
References: 
 >Simple Newbie Question on Calling a Method (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Bindings: Value With Pattern Question
  • Next by Date: Re: Simple Newbie Question on Calling a Method
  • Previous by thread: Simple Newbie Question on Calling a Method
  • Next by thread: Re: Simple Newbie Question on Calling a Method
  • Index(es):
    • Date
    • Thread