0
- 的XCode 4.3.2
- MacRuby的0.12(紅寶石1.9.2)[萬向darwin10.0,x86_64的]
- 最新夜間作爲6月4日的,2012
- OS 10.7.3
目標
具有從MainMenu.xib一個單獨的廈門國際銀行與某些控件窗口,然後可以以編程方式打開該窗口。我不希望它在發佈時打開。
嘗試
- 我做了一個新的廈門國際銀行(Woot.xib),並在其創建的窗口
我做了一個新的Ruby類
class WootController < NSWindowController attr_accessor :window def windowNibName return 'Woot' end end
- 我試圖設置Woot.xib中的文件所有者類爲WootController,但發現它不會如果
< NSWindowController
在我的類定義中。如果我從類定義中刪除< NSWindowController
,那麼插座將填充,我可以將XIB中的窗口鏈接到我班的窗口。 從我的AppDelegate的
applicationDidFinishLaunching
方法裏面,我已經試過嘗試
newWind = WootController.new puts newWind #outputs "#<AddCredentialsDialog:0x400191180>" newWind.window().makeKeyAndOrderFront(self) # results in no method error for nil
嘗試2
newWind = WootController.initWithWindowNibName 'AddWindow' puts newWind #outputs "#<AddCredentialsDialog:0x400191180>" newWind.window().makeKeyAndOrderFront(self) # results in no method error for nil
問題
- 爲什麼我的任何一次嘗試都不工作?我準備好了關於macruby和使用NSWindowController的所有內容。
- 爲什麼我不能鏈接到我的
WootController
類,如果我把它從NSWindowController
- 繼承是否有不同的方式來做到這一點除了把它全部MainMenu.xib?