我想創建一個全屏應用程序(mac),但事實上我有窗口全屏; [window setFrame:[window frameRectForContentRect:[[window screen] frame]]display:YES animate:YES];
Xcode全屏窗口無標題欄
我不能擺脫標題欄?你可以改變上面的代碼,使窗口沒有標題欄,或者你需要完全不同嗎?謝謝:)
我想創建一個全屏應用程序(mac),但事實上我有窗口全屏; [window setFrame:[window frameRectForContentRect:[[window screen] frame]]display:YES animate:YES];
Xcode全屏窗口無標題欄
我不能擺脫標題欄?你可以改變上面的代碼,使窗口沒有標題欄,或者你需要完全不同嗎?謝謝:)
CocoaWithLove有一個關於它的好文章:
http://cocoawithlove.com/2009/08/animating-window-to-fullscreen-on-mac.html
fullscreenWindow = [[FullscreenWindow alloc]
initWithContentRect:[mainWindow contentRectForFrameRect:[mainWindow frame]]
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES
screen:[mainWindow screen]];
[fullscreenWindow setLevel:NSFloatingWindowLevel];
[fullscreenWindow setContentView:[mainWindow contentView]];
[fullscreenWindow setTitle:[mainWindow title]];
[fullscreenWindow makeKeyAndOrderFront:nil];
我成功地放置在窗口上使用窗位NSScreenSaverWindowLevel
標題欄,而不是NSFloatingWindowLevel
在Macmade的答覆建議。
fullscreenWindow = [[NSWindow alloc]
initWithContentRect:[[NSScreen mainScreen] frame]
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES];
[fullscreenWindow setLevel:NSScreenSaverWindowLevel];
// Perform further configuration here, e.g. setTitle, setBackgroundColor etc.
[fullscreenWindow makeKeyAndOrderFront:nil];
這不工作:(,我讀了之前的網站我張貼的問題...我使用的Xcode 4,我不知道這是否是我做錯了什麼,或者Xcode的只是不會做呢? ??謝謝你的回答,雖然:) – 2011-03-22 21:33:39