• 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: Robert Cerny <email@hidden>
  • Date: Fri, 20 Feb 2004 17:16:16 +0100

Hi,
I believe there was a post from somebody from Apple, that framework
inside framework isn't possible. The obvious variant Cocoa and Carbon
are umbrella frameworks which are a different case.

HTH
Robert

On 20.2.2004, at 16:46, Bill Houston wrote:

> I am writing a framework that can be included in the framework folder
> of an
> application bundle, or dynamically loaded by the application at run
> time.
> This framework includes a localized nib file in it's resource folder.
> The
> nib file can be loaded normally when the framework is in the
> applications
> bundle, but when the framework is loaded dynamically I am passed a
> path to
> the framework by the application that loaded it. I need to load the
> nib
> using the path, but I have not found a straight forward way to do it.
> I
> have included the code for my best attempt below:
>
> - (id)init:(const char*)frameworksPath {
> self = [super init];
> // 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 *pathString = [NSString stringWithCString:
> frameworksPath
> ];
> NSBundle *frameworksBundle = [NSBundle bundleWithPath:
> pathString ];
> if(![frameworksBundle load]) {
> NSLog(@"failed to load Nib from specified location");
> if (![NSBundle loadNibNamed:@"MY_UI" owner:self]) {
> NSLog(@"failed to load MY_UI nib from main bundle");
> }
> }
>
> }
> noPath:
> noBundle:
> return self;
> }
>
> This code works when frameworksPath is NULL, but does not when
> frameworksPath has a path to the frameworks bundle.
> It seems that "[frameworksBundle load]" will not load a nib, only the
> code
> resources, and "loadNibNamed" does not work with a bundle.
>
> I have searched and searched for a way to load a nib from a specific
> bundle,
> but cannot find one. Can anyone point me in the right direction?
>
> Thanks,
> Bill
> _______________________________________________
> 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.

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.

References: 
 >How to load a nib from a path (From: Bill Houston <email@hidden>)

  • Prev by Date: Re: iCal.app database backend
  • Next by Date: Re: Versioning
  • 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