• 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: How to load a nib from a path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to load a nib from a path


  • Subject: Re: How to load a nib from a path
  • From: Bill Houston <email@hidden>
  • Date: Fri, 20 Feb 2004 10:38:05 -0800

Sorry,

I should have sent back the exact example:

// init the application
NSApplicationLoad();
// check to see if we got a path from our host application
if(frameworksPath == NULL) {
if (![NSBundle loadNibNamed:@"MY_UI" owner:self]) {
NSLog(@"failed to load MY_UI nib");
}
} else {

// try to use the path we were given
NSString *frameworksPathString = [NSString
stringWithCString:frameworksPath];
NSBundle *frameworksBundle = [NSBundle
bundleWithPath:frameworksPathString];

if([frameworksBundle loadNibFile:@"MY_UI" externalNameTable:
[NSDictionary dictionaryWithObject:self forKey:@"NSOwner"] zone:[self
zone]]) {
// if([frameworksBundle loadNibNamed:@"MY_UI" owner:self]) {
NSLog(@"failed to load Nib from specified location");
}

}
sharedController = self;
return self;


Which complies with this error:
Error : unknown message selector
Controller.m line 31 if([frameworksBundle loadNibFile:@"MY_UI"
externalNameTable: [NSDictionary dictionaryWithObject:self
forKey:@"NSOwner"] zone:[self zone]]) {

Bill

On 2/20/04 10:30 AM, "j o a r" <email@hidden> wrote:

>
> On 2004-02-20, at 19.17, Bill Houston wrote:
>
>> Here is the warning I get when I compile the code:
>>
>> Warning : receiver cannot handle this message
>> Controller.m line 31 if([frameworksBundle loadNibNamed:@"MY_UI"
>> owner:self]) {
>
> Right, but you're not using the code that Sailor Quasar gave you...
>
> The reason you get the warning is that "loadNibNamed:owner:" is a class
> method. Being a class method it can only be sent to the NSBundle class
> object, and not instances of the NSBundle class. Read more on that
> topic in the Objective-C PDF that Apple provides with their development
> tools.
>
> Weird warning message btw. - what compiler are you using? It's not GCC,
> right? CodeWarrior?
>
> j o a r
_______________________________________________
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.

  • Follow-Ups:
    • Re: How to load a nib from a path
      • From: Sailor Quasar <email@hidden>
    • Re: How to load a nib from a path
      • From: j o a r <email@hidden>
References: 
 >Re: How to load a nib from a path (From: j o a r <email@hidden>)

  • Prev by Date: Re: Loading nibs in plugins
  • Next by Date: Re: How to load a nib from a path
  • Previous by thread: Re: How to load a nib from a path
  • Next by thread: Re: How to load a nib from a path
  • Index(es):
    • Date
    • Thread