• 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
Some questions about NSBundle and osx
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some questions about NSBundle and osx


  • Subject: Some questions about NSBundle and osx
  • From: Gore <email@hidden>
  • Date: Fri, 23 Nov 2001 21:48:08 +0200

There are 3 questions I would be happy to get answer for:

1:
I have created an app that downloads a picture from a www-site and saves it to the disk in the ~/Documents/ directory, it would be fun to have macosx directly update and use that picture as desktop-picture, is that possible ?

2:
I would like to know how to load bundles correctly, should I have a NSBundle instance global or can I release the NSBundle instance I used to load the classes with ?

3:
What should I do to load the resources inside a bundle in a correct way ? here is what I do right now, this code is inside my NSDocument class, used to load the interface for my plugins, but if I open a new document and try to load it again, it gives me the "Error in loading interface." error, hmm...please help, newID is a global instance.

- (IBAction)runPluginWithMenu:(id)sender // sender is a NSMenuItem
{
NSBundle *thePlugin = [NSBundle bundleWithPath:
[[[NSBundle mainBundle] builtInPlugInsPath] stringByAppendingFormat: @"/%@.bundle", [sender title]]];

currentPluginName = [sender title];

if ( runningPlugin == NO ) // just to be safe...
{
if ( [thePlugin load] )
{
newID = [[[thePlugin principalClass] alloc] init];

[newID setCurrentDocument: self];

if ( [newID pluginIsGUI] )
{
if ( [NSBundle loadNibNamed: @"PluginInterface" owner: newID] ) // should the owner be a class or instance!?
{
[pluginsPanel setMinSize: newFrame.size];
[pluginBox setContentView: [newID pluginView]];

runningPlugin = YES;

[NSApp beginSheet: pluginsPanel modalForWindow: docWindow
modalDelegate: self didEndSelector: NULL contextInfo: nil];
}
else
NSRunAlertPanel( [sender title], @"Error in loading interface.", @"OK", nil, nil );
}
else
{
runningPlugin = YES;
[self runThePlugin: self];
}
}
else
NSRunAlertPanel( [sender title], @"Error in loading plugin.", @"OK", nil, nil );
}
}


  • Prev by Date: Re: LayoutManager
  • Next by Date: Re: Mutability
  • Previous by thread: Re: LayoutManager
  • Next by thread: Rotating NSImage in NSImageView
  • Index(es):
    • Date
    • Thread