我有一些显示窗口的代码......
- (IBAction)displayWindow:(id)sender
{
NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 50, 50) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[window setBackgroundColor:[NSColor blackColor]];
[window setAlphaValue:.5];
[window setLevel:kShadyWindowLevel];
[window setReleasedWhenClosed:YES];
[window makeKeyAndOrderFront:self];
self.window = window;
}
并关闭窗口....
- (IBAction)closeWindow:(id)sender
{
[self.window close];
}
并且 window 被定义为一个强大的属性......
@property (strong) NSWindow *window;
该代码第一次工作,但是当第二次显示窗口时...
self.window = window;
因 EXC_BAD_ACCESS 崩溃...
我究竟做错了什么?
提前致谢....