• 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: Show a window from another nib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Show a window from another nib


  • Subject: Re: Show a window from another nib
  • From: Marcus Karlsson <email@hidden>
  • Date: Fri, 3 Nov 2006 20:45:15 +0100

Thank you. I finally got it working.

I also looked at the SimpleMultiWindow example (Developer/Examples/ InterfaceBuilder/SimpleMultiWindow) and now I could finally understand how it worked.

Marcus

On 3 nov 2006, at 19.11, Scott Ribe wrote:

I popped that last email out too quickly and left out some explanation:

- There should be an instance of MyWindowController in the nib with the
window. Its window outlet should be connected the the window, and the
window's delegate outlet should be connected to it.


- In the simple case where you have just one window in the nib, don't create
a new instance of MyWindowController, just set the file's owner object's
custom class to MyWindowController.



Roughly speaking (many variations possible, depending on how you organize
your project):



@interface MyWindowController : NSWindowController { }

+ ( MyWindowController *) createAndShowWindow;

@end


@implementation MyWindowController

+ ( MyWindowController *) createAndShowWindow
{
    MyWindowController  * wdw = [[ MyWindowController alloc] _init];
    [[wdw window] makeKeyAndOrderFront: self];
    return wdw;
}

- (id) _init
{
    self = [super initWithWindowNibName: @"MyWindowNib" owner: self];
    return self;
}


-- Scott Ribe email@hidden http://www.killerbytes.com/ (303) 722-0567 voice



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Show a window from another nib (From: Scott Ribe <email@hidden>)

  • Prev by Date: Making Package Folders
  • Next by Date: Re: partially convert an nsimage to grayscale
  • Previous by thread: Re: Show a window from another nib
  • Next by thread: Mouse tracking & selection in composite view
  • Index(es):
    • Date
    • Thread