Re: Pref Panes and Instance Variables?
Re: Pref Panes and Instance Variables?
- Subject: Re: Pref Panes and Instance Variables?
- From: "Josh M. Hurd" <email@hidden>
- Date: Sun, 13 Jan 2002 00:34:24 -0800
OK I figured out what was wrong.
I had instantiated my subclass of NSPrefPane in Interface Builder making
my connections to that instance.
This caused a second instance of my subclass to be created when the Nib
loaded. Who knows which one had control, I think they both had a little
here and there...
I thought this was how the Apple docs explained it but I must have
mis-read something...
The correct answer is change the class of the File's Owner to my
subclass of NSPrefPane then make connections to that.
Thanks list...
M
On Saturday, January 12, 2002, at 08:05 PM, Josh M. Hurd wrote:
Hello list,
I am having trouble with instance variables in my PrefPane.
I declare my variables in the header of my Principal Class like this:
@private
NSMutableArray *theAppList;
CFStringRef appID;
Then initialize them in initWithBundle like this:
- (id)initWithBundle:(NSBundle *)bundle
{
if ( ( self = [super initWithBundle:bundle] ) != nil )
{
appID = CFSTR("myPrefPaneBundleIdentifier");
theAppList = [NSMutableArray array];
}
return self;
}
Which is how Apple explains it in their PrefPane docs.
So far everything is OK.
I then fill my instance variable theAppList in mainViewDidLoad. This
too works fine but when I return out of this method all my variables
are killed. I set up a button which triggers a dump of these variables
via NSLog which confirm they are NULL or empty.
I can't imagine that this is a limitation to the PrefPane framework so
would someone kindly let me know what I am doing wrong?
Thanks!
M
_______________________________________________
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.