• 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
Newbie question: instantiate a class in its header file OR in IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie question: instantiate a class in its header file OR in IB


  • Subject: Newbie question: instantiate a class in its header file OR in IB
  • From: JArod Wen <email@hidden>
  • Date: Tue, 24 Jun 2008 23:34:19 -0400

Hi Gurus,

I am a cocoa newbie from Java. Recently I found an example code in which the instance of a class is defined in its own class's header file, as following:

@interface AppController : NSObject {

	// Instance variables here

}

AppController *appController;


And then this head file will be imported in MyDocument.h(there are methods using appController in MyDocument.m).


I am a little bit confused by this code. Since always we will create the controller in IB and then I think the instance will be created by IB, right? So is there any advanced features/reasons for this kind of usage?

In my opinion, I'd like to have a line of

IBOutlet AppController *appController;

in my MyDocument.h and then connect it with the appController in IB. Which implementation will be preferred by you?

Thanks in advance for any instructions!

---------------
JArod Wen




_______________________________________________

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


  • Follow-Ups:
    • Re: Newbie question: instantiate a class in its header file OR in IB
      • From: Jens Alfke <email@hidden>
    • Re: Newbie question: instantiate a class in its header file OR in IB
      • From: Andrew Farmer <email@hidden>
  • Prev by Date: Re: Core Animation: Disabling Implicit Animations
  • Next by Date: Re: Core Animation: Disabling Implicit Animations
  • Previous by thread: Re: Leak in NSSavePanel
  • Next by thread: Re: Newbie question: instantiate a class in its header file OR in IB
  • Index(es):
    • Date
    • Thread