2011-03-28 81 views
1

我正在嘗試全屏無邊框全屏窗口。我可以顯示它,但它看起來是空的,因爲我不知道如何告訴它使用我的一個NIB文件。我正在使用以下代碼創建窗口:使用筆尖設計創建可可無邊框窗口

int windowLevel = CGShieldingWindowLevel(); 
NSRect screenRect; 
screenRect = [[NSScreen mainScreen] frame]; 
ventanaBloqueo = [[Escucha alloc] 
      initWithContentRect:screenRect 
      styleMask:NSBorderlessWindowMask 
      backing:NSBackingStoreBuffered 
      defer:NO 
      screen:[NSScreen mainScreen]]; 

其中'Escucha'是NSWindow子類。我怎麼能告訴窗口使用我的NIB設計之一?

Regards

回答

1

我會使用窗口控制器。它更容易,更有序。

例如:

NSWindowControllerSubclass* controller = [[NSWindowControllerSubclass alloc] initWithNibName:@"nibName"]; 
+0

但我需要重寫initWithContentRect和力被調用。我如何使用控制器來做到這一點? – LooPer 2011-03-28 14:45:24

+1

像這樣嘗試:[[window contentView] enterFullScreenMode:[NSScreen mainScreen withOptions:nil];當我是你時,我會讀一些關於窗戶的信息。嘗試瞭解NSWindowController。 – lbrndnr 2011-03-28 17:02:27