Pregunta

My app has an icon in the menubar. A NSPanel shows up when I click the icon. But why does the NSPanel not have a background color like other having gray background NSWindow? My NSPanel's background looks like transparent. My NSPanel comes from a .xib file. My code as follows:

(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;
}
¿Fue útil?

Solución

Generally NSPanels are semi-transparent. See here for more information. If you don't want the semi-transparency you could change NSPanel in IB under custom class from NSPanel to NSWindow.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top