• 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: LoadNib not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Cocoa threading, objects by reference, and the keyword "oneway"
  • Next by Date: Re: int question
  • Previous by thread: Re: LoadNib not working
  • Next by thread: C++ framework <-> Cocoa
  • Index(es):
    • Date
    • Thread