私は、OSX LionでNSWindowControllerをフルスクリーンモードでプログラム的に実行する方法を広範に調査しました。OSX LionでNSWindowControllerをフルスクリーンモードで実行するにはどうすればいいですか?
チャプター/時21は、それを行う方法を教えてくれるはずだったので、「サムスは自分でMac OS X Lion App開発を教えてください。私は、この本のコードがしばしばうまくいかないというレビューを見ました。私はとにかくチャンスを取ったよ、ええ!
上記の章のサンプルには、a linkがあります。
基本的には、ここに上記の時間21に基づいて、私はちょうどテストプログラムのために持っているものです。私はそれにNSObjectの割り当てられWeatherWindowControllerを追加
#import <Cocoa/Cocoa.h>
@interface WeatherWindowController : NSWindowController
- (IBAction)toggleFullScreen:(id)sender;
@end
。私は適切にNSLogステートメントを記録しているように接続されているボタンがあります。
#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
あなたのnibファイルに 'window'アウトレットが接続されていますか? –
@RobKenigerそれは、ありがとう! – Dan