• 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: Can't get an NSDocument subclass to load nib...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't get an NSDocument subclass to load nib...


  • Subject: Re: Can't get an NSDocument subclass to load nib...
  • From: email@hidden
  • Date: Sun, 23 Jun 2002 07:09:13 -0500

The problem is that YOU are init'ing the document..

What you need to do (and I admit I am a bit vague on this myself.. ) is to use
the applications NSDocumentController factory to do the work..

NSDocumentController *dc = [ NSDocumentController sharedDocumentController ] ;
[ dc openUntiltedDocumentOfType: @"XXXX" display: YES ] ;

Where @"XXXX" is a registered document type that your application says it can handle..

(there are lots of interesting methods to manage your applications documents in the NSDocumentController..
the above is just one example.. you can open from a filename path, etc. etc. )

Anyway, by having NSDocumentController do the work all the right "magic" should happen for you..

This actually is a good way to handle the other issue you raised in a prior query.. how do have one document
open a subdocument ... just have the main document invoke the "proper" NSDocumentController method
(the above for example returns the created document object btw..) and keep it around..

Hope this helps..

-SJM

On Sunday, June 23, 2002, at 12:53 AM, Jiva DeVoe wrote:

I have created an NSDocument subclass and set it as the owner for a nib
file. I have also overridden the method "windowNibName" in the document to
return the name of the nib file (sans extension). Yet, when I init the
document, it doesn't seem to call windowNibName at all, and thus, I get no
NSWindowControllers for it. Is there some special initializer syntax I need
to call for this to work? Here's my init n stuff:

-(id)init
{
NSLog(@"PersonDocument init");
self = [super init];
return self;
}

-(void)windowControllerDidLoadNib:(NSWindowController *) aController
{
[super windowControllerDidLoadNib:aController];
NSLog(@"Loaded the window.");
}

- (NSString *)windowNibName
{
NSLog(@"returning window nib name.");
// Implement this to return a nib to load OR implement
-makeWindowControllers to manually create your controllers.
return @"PersonDocument";
}
_______________________________________________
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.
_______________________________________________
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: 
 >Can't get an NSDocument subclass to load nib... (From: Jiva DeVoe <email@hidden>)

  • Prev by Date: Re: Using Darwin headers
  • Next by Date: NSOutlineView recursive calling crashing app
  • Previous by thread: Can't get an NSDocument subclass to load nib...
  • Next by thread: Re: Can't get an NSDocument subclass to load nib...
  • Index(es):
    • Date
    • Thread