jeudi 26 mars 2015

NSWindow closing and controlling issues in Mac OS X


Vote count:

0




I met the issues of NSWindow regarding closing it when the application starts. There are plenty of examples, however, I can not get the proper effect, perhaps I missing something.


Firstly, in many examples there is the recommendation to use "[self window]" but I get the error like "No visible @interface for 'ViewController' declares the selector 'window'".


Then I use the round way: "[[self view] window]". Anyway, the window is not closed after the execution of the code:



NSWindow *win = [[self view] window];
[win performClose:self];


or



NSWindow *win = [[self view] window];
[win close];


The next one also does not give any results as I expect, according to the documentation:



[win orderOut:self];


The code compiles but I can see the window. Of course, I tried:



NSLog(@"%@", [win.windowController windowShouldClose:self] ? @"YES" : @"NO" );


It outputs "NO", so, it means that the window, which appear when I run my application, cannot be closed? Is there any way how to work around it? Why I cannot control that main window following the way the documentation suggests?


I checked for the import "#import ;" as well.



asked 40 secs ago







NSWindow closing and controlling issues in Mac OS X

Aucun commentaire:

Enregistrer un commentaire