Re: LoadNib not working
Re: LoadNib not working
- Subject: Re: LoadNib not working
- From: Enrique Zamudio <email@hidden>
- Date: Wed, 06 Jun 2001 12:16:24 -0500
- Organization: Nasoft
Well if the problem is that the nib is not being shown, then I think the problem is really one of concepts.
The nib is just a file containing objects, usually UI objects, like windows.
If you save a nib file with an open window, it doesn't mean the window will open whenever you load the nib. So, let's say the owner of the nib has an outlet to a window that you want to show (that's why you're loading the nib, right?)
- (void)showCountDown:(NSBundle*)bundle
{
if (![[bundle class] loadNibNamed:@"CountDown" owner:self]) {
//If the nib loads correctly then this doesn't happen
NSLog(@"Failed to load CountDown.nib");
NSBeep();
return;
} else
[myWindow makeKeyAndOrderFront:self];
}
Also, you generally need to load nibs only once. So perhaps this is more useful:
- (void)showCountDown:(NSBundle*)bundle
{
if (myWindow == nil) {
if (![[bundle class] loadNibNamed:@"CountDown" owner:self]) {
//If the nib loads correctly then this doesn't happen
NSLog(@"Failed to load CountDown.nib");
NSBeep();
return;
}
}
[myWindow makeKeyAndOrderFront:self];
}
I hope this helps.
eZL