0
如何修改以及通過編程插入avCocoa NSButton
? (適用於Mac的不是iPhone)如何修改以編程方式插入Cocoa NSButton的類和文件?
我曾嘗試以下,但它不工作:(的東西不是一個結構或聯合申請成員「意見」)
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
{
[super windowControllerDidLoadNib:aController];
// Add any code here that needs to be executed once the windowController has loaded the document's window.
NSButton *btn = [NSButton alloc];
[self.view addSubview:btn];
}
您還沒有初始化該按鈕。你已經調用了'alloc'而不是'initWithFrame:'。在對類調用'alloc'後,必須始終調用對象的初始化方法。 – 2011-12-20 00:23:26