0
我使用此源http://www.cats.rwth-aachen.de/library/programming/cocoa無法點擊按鈕
創建我的自定義工作表。
我創建在現有的.xib文件NSPanel
對象,並使用IBOutlet
我的源代碼連接:
.H
@interface MainDreamer : NSWindow <NSWindowDelegate>
{
...
NSPanel *newPanel;
}
...
@property (assign) IBOutlet NSPanel *newPanel;
的.m
@dynamic newPanel;
...
//this method is wired with button on main window and calls a sheet
- (IBAction)callPanel:(id)sender
{
[NSApp beginSheet:newPanel
modalForWindow:[self window] modalDelegate:self
didEndSelector:@selector(myPanelDidEnd:returnCode:contextInfo:)
contextInfo: nil]; //(__bridge void *)[NSNumber numberWithFloat: 0]
}
//this method is wired with cancel and ok buttons on the panel
- (IBAction)endWorkPanel:(id)sender
{
[newPanel orderOut:self];
[NSApp endSheet:newPanel returnCode:([sender tag] == 9) ? NSOKButton : NSCancelButton];
}
//closing a sheet
- (void)myPanelDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSCancelButton) return;
else{
return;
}
}
所以callPanel
工作正常,工作表出現,但我無法與工作表上的控件(帶按鈕)進行交互。他們不會對點擊產生反應(甚至直觀)。
問題出在哪裏?