성공적으로, 나는 OSX Lion에서 전체 화면 모드로 NSWindowController를 프로그래밍 방식으로 실행하는 방법을 광범위하게 연구했습니다.NSWindowController를 OSX Lion에서 전체 화면 모드로 실행하는 방법은 무엇입니까?
챕터/시간 21은 어떻게 할 것인지를 가르쳐야하기 때문에 "Sams Teacher Mac OS X Lion App Development"를 구입하기까지했습니다. 이 책의 코드가 자주 작동하지 않는다는 리뷰를 보았습니다. 어쨌든 내 기회를 잡았어, 우!
여기에 언급 된 장의 예제는 a link입니다. 내가 NSObject의 및 할당 WeatherWindowController을 추가
#import <Cocoa/Cocoa.h>
@interface WeatherWindowController : NSWindowController
- (IBAction)toggleFullScreen:(id)sender;
@end
: 기본적으로, 여기
내가 위에 나열된 시간 21 일을 기준으로, 단지 테스트 프로그램에있는 것입니다. 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