Fighting the NSWindowController Outlet Window

I'm sure this is a really simple problem, but I am pulling my hair out!

I have a subclass of NSWindowController called WinAController. It was created in IB and is located in MainMenu.xib.

I have a separate tip called WinA.xib that contains only one window. In this nib, I installed the following:

  • File Owner Class WinAController
  • windowFile Owner Property for WinA
  • WinA deadlock for WinAController(which implements the NSWindowDelegate protocol).

I connected the MainMenu menu item to the method -showWindowfor WinAController so that when you click on it, WinA displays, but nothing happens. It seems that the WinAController property is windownot set.

Where am I mistaken? Do I need to initialize WinAController with WinA.xib at some point in the code to install this?

Thank,

+3
source share
2 answers

This, called from WinAController, seems to work fine:

- (id)init {
// Load our window from the nib
self = [super initWithWindowNibName:@"WinA"];

// Now we're initialised - return us
return self;
}
0
source

Garry - I had a similar problem with the dialog using code in your answer above. I could display the dialog once, but after that it was not visible again (I had a simple test application with a window with a button for displaying the dialog). I continued to see answers with "connect the window output to the File Owner object to the window in your nib", but could not figure out how to do this. It sounds like part of what you are asking.

: -

0

Source: https://habr.com/ru/post/1746380/


All Articles