• 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: NSDocument Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDocument Question


  • Subject: Re: NSDocument Question
  • From: Sherm Pendley <email@hidden>
  • Date: Mon, 7 Feb 2011 15:11:28 -0500

On Mon, Feb 7, 2011 at 2:54 PM, Bruce Cresanta <email@hidden> wrote:
> Ii have two subclasses of NSDocument.   One of the subclasses only ever needs one instance window.   How do I query NSWindowController for the open window, and if that fails, create it.   Sorry for the confusion.

Override -makeWindowControllers. The default calls -windowNibName, and
loads a new instance of the named Nib for every document, but you can
change that behavior to re-use a single window controller:

- (void)makeWindowControllers {
    static NSWindowController *windowController;
    if (!windowController) {
        windowController = [[NSWindowController alloc]
initWithWindowNibName:@"MyDocumentNib" owner:self];
    }
    [self addWindowController:windowController];
}

sherm--

--
Cocoa programming in Perl:
http://camelbones.sourceforge.net
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSDocument Question (From: Bruce Cresanta <email@hidden>)
 >Re: NSDocument Question (From: Quincey Morris <email@hidden>)
 >Re: NSDocument Question (From: Bruce Cresanta <email@hidden>)

  • Prev by Date: NSDrawer dealloc causes kCGErrorIllegalArgument
  • Next by Date: Re: NSDocument Question
  • Previous by thread: Re: NSDocument Question
  • Next by thread: Re: NSDocument Question
  • Index(es):
    • Date
    • Thread