4
我的应用程序在菜单栏中有一个图标。当我点击图标时出现NSPanel
。但为什么NSPanel
没有像灰色背景NSWindow
其他背景颜色?我的NSPanel
的背景看起来像透明。我的NSPanel
来自.xib
文件。我的代码如下:为什么我的NSPanel没有正常的灰色背景?
(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;
}
谢谢你的回答。问题解决了。 – gohamgx