Skip navigation.
 
mlNewbie question: instantiate a class in its header file OR in IB
FROM : JArod Wen
DATE : Wed Jun 25 05:34:19 2008

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

Related mailsAuthorDate
mlNewbie question: instantiate a class in its header file OR in IB JArod Wen Jun 25, 05:34
mlRe: Newbie question: instantiate a class in its header file OR in IB Andrew Farmer Jun 25, 07:28
mlRe: Newbie question: instantiate a class in its header file OR in IB Jens Alfke Jun 25, 07:32
mlRe: Newbie question: instantiate a class in its header file OR in IB JArod Wen Jun 25, 16:01
mlRe: Newbie question: instantiate a class in its header file OR in IB Jens Alfke Jun 25, 17:44