我的应用程序在菜单栏中有一个图标。NSPanel
当我单击图标时会出现A。但是为什么没有NSPanel
像其他灰色背景那样的背景颜色NSWindow
呢?我NSPanel
的背景看起来像透明的。我NSPanel
来自一个.xib
文件。我的代码如下:
(void)openPanel
{
NSLog(@"openPanel");
NSWindow *panel = self.panelController.window;
NSRect rect = [[[NSApp currentEvent] window] frame];
NSLog(@"rect.origin.x = %f",rect.origin.x);
NSLog(@"rect.origin.y = %f",rect.origin.y);
NSLog(@"rect.size.width = %f",rect.size.width);
NSLog(@"rect.size.height = %f",rect.size.height);
[panel setFrame:NSMakeRect(rect.origin.x, rect.origin.y-100, 200, 100) display:YES];
[NSApp activateIgnoringOtherApps:NO];
[panel makeKeyAndOrderFront:nil];
isPanelVisible = YES;
}