I have an NSPopover
in a Cocoa application, and since Lion - it renders as semi-transparent, so that whatever text fields, tables, etc. that it overlays - these now show through underneath it and it looks really strange. I checked the class reference docs from Apple, but there doesn't seem to be a way to change it to be opaque. The only two property values that seem to be available to specify appearance are NSPopoverAppearanceMinimal
, and NSPopoverAppearanceHUD
- but neither of these seem to relate to alpha or opacity. Is the only way to make an NSPopover
opaque by over-riding drawRect ? or does anyone know of a better way to do it ? It seems to be available for UIPopover
on iOS, but not NSPopover
for Cocoa...
Would like to change the opacity for an NSPopover - is it possible?
What version of OSX are you using? I don't see that behavior with the minimal appearance -- seems pretty opaque to me. If you want to change the background, it's easy enough to add an NSBox (of the custom type) to cover the whole view and then give it whatever background color you want. –
Rourke
I am using OSX 10.8. It is mostly opaque, but you can still see the text behind the popover slightly. Tried adding the NSBox (of custom type) to cover the whole thing - which worked, but it draws itself on top of the text that is in the popover, and even if it is placed on the bottom most layer (in IB), it still renders over the text fields that are contained in the Popover. I am sure that there is a way to do it programmatically ... will try to post the solution here as soon as I figure it out. Thanks! –
Clownery
The text fields and any other UI element you have should all be embedded in the box -- you do this by selecting all of them and then clicking on "Embed In" option under the Editor menu. This makes them all subviews of the box, and they will appear on top. –
Rourke
That's a duplicate question. And no, you can't change opacity. –
Kafiristan
To turn the background fully opaque, please have a look at this post:
How to change NSPopover background color include triangle part?
I ran into the exact same problem and the solution in this article helped me solve the problem. –
Casmey
© 2022 - 2024 — McMap. All rights reserved.