Unsuccessfully, I have searched extensively on how to programatically make an NSWindowController run in full screen mode in OSX Lion.
I even went so far as to buy, “Sams Teach yourself Mac OS X Lion App Development” because chapter/hour 21 was supposed to teach how to do that. I saw some reviews that the code in this book does not often work. I took my chances anyway, ugh!
Here’s a link to a sample of the chapter mentioned above.
Basically, here is what I have for just a test program,based on hour 21 listed above:
#import <Cocoa/Cocoa.h>
@interface WeatherWindowController : NSWindowController
- (IBAction)toggleFullScreen:(id)sender;
@end
I added an NSObject and assigned WeatherWindowController to it. I have a button that is connected properly as it is logging the NSLog statements properly.
#import "WeatherWindowController.h"
@interface WeatherWindowController ()
@end
@implementation WeatherWindowController
- (id)initWithWindow:(NSWindow *)window
{
self = [super initWithWindow:window];
if (self) {
// Initialization code here.
}
return self;
}
-(void) awakeFromNib{
self.window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary;
}
- (void)windowDidLoad
{
[super windowDidLoad];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
}
- (IBAction)toggleFullScreen:(id)sender {
NSLog(@"before toggleFullScreen");
[self.window toggleFullScreen:sender];
NSLog(@"after toggleFullScreen");
}
@end
There shouldn’t be any need to implement this method in the window controller, since its window will also be in the responder chain, and should therefore receive the action when you choose the “Enter/Exit Full Screen” menu item that you added to your view menu and connected to the First Responder.
So, assuming you’ve created and so configured that menu item, what does happen when you choose it?