全画面アプリケーションを作成しようとすると、奇妙な問題に直面しています。現在、aaNSWindow
を使用NSBorderlessWindowMask
して画面を上部に表示し、NSWindow
キーを受け入れるようにサブクラス化しています。
- (BOOL) canBecomeKeyWindow
{
return YES;
}
これは問題なく動作し、ウィンドウでキーを使用して、Command + Q でアプリケーションを終了できます。ただし、Mac でアプリケーションを強制終了しようとすると、画面がフリーズし、コンピュータを再起動する必要があります。ウィンドウ内に単純な WebView があります。
mainWindow = [[MyBorderWindow alloc] initWithContentRect:screenRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO screen:[NSScreen mainScreen]];
[mainWindow setLevel:windowLevel];
[mainWindow setBackgroundColor:[NSColor blackColor]];
[mainWindow makeKeyAndOrderFront:nil];
NSView *contentView = [mainWindow contentView];
WebView *customView = [[WebView alloc] initWithFrame:[contentView bounds]];
[customView setTranslatesAutoresizingMaskIntoConstraints:NO];
[contentView addSubview:customView];
別のコンピューターでアプリケーションを試しましたが、強制終了しても画面がフリーズしません。どちらのコンピューターも OS X Mavericks を実行しています。
他に追加すべきことがあれば教えてください。
前もって感謝します、
ブッコ
編集:
AppDelegate の applicationWillTerminate メソッドが問題の一部である可能性があると思いますが、よくわかりません。この方法が別のコンピューターでは正常に機能するのに、私のコンピューターでは機能しないのはなぜですか?
- (void)applicationWillTerminate:(NSNotification *)notification
{
[mainWindow orderOut:self];
// Release the display(s)
if (CGDisplayRelease( kCGDirectMainDisplay ) != kCGErrorSuccess) {
NSLog( @"Couldn't release the display(s)!" );
}
}