• 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: Loading nibs in plugins
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading nibs in plugins


  • Subject: Re: Loading nibs in plugins
  • From: Rainer Brockerhoff <email@hidden>
  • Date: Fri, 20 Feb 2004 09:40:18 -0300

At 15:41 -0800 19/02/2004, email@hidden wrote:
>Date: Thu, 19 Feb 2004 18:39:30 -0500
>From: John Timmer <email@hidden>
>
>I've found one or two examples of creating and loading a plugin, but I seem
>to not be getting something. I'd like to have an object that's got a couple
>of outlets in a nib file in order to access some interface elements. If I
>do:
>
>while ( pluginPath = [pluginEnumerator nextObject] ) {
> pluginBundle = [NSBundle bundleWithPath: pluginPath];
>
> if (pluginClass = [pluginBundle principalClass]) {
> if ([pluginClass conformsToProtocol:@protocol(myProtocol)] ) {
> aPlugin = [[pluginClass alloc] init];
> }
> }
>
>I do get a valid object with the appropriate structure, so I know that the
>bundle and class are working properly. The problem seems to be that the
>alloc/init combination doesn't hook up the outlets within the nib (they're
>set to 0). Given that, what do I use to to initialize one of these objects
>while properly hooking up the nib outlets?

Hi John,

See my paper on plugins at:
http://www.brockerhoff.net/Paper2002.dmg.sit
for a working example.

Basically, you need to call loadNibNamed: somewhere in the plugins initialization; in your example, inside init. A bundle's main nib is never loaded automatically. For application bundles, NSApplicationMain does it, so many people assume it's automatic ;-).

HTH,
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"It's extremely unlucky to be superstitious, for no other reason
than it is always unlucky to be colossally stupid." (Stephen Fry)
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
_______________________________________________
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.

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