Re: Window With Transparent Background
Re: Window With Transparent Background
- Subject: Re: Window With Transparent Background
- From: Ken Thomases <email@hidden>
- Date: Tue, 24 Jan 2017 19:58:38 -0600
On Jan 24, 2017, at 11:17 AM, Richard Charles <email@hidden> wrote:
>
> Consider a window presented as a sheet with background transparency.
>
> - (void)windowDidLoad
> {
> // Produces gray background with transparency.
> NSColor *color = [NSColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:0.9];
> self.window.backgroundColor = color;
> }
>
> - (void)windowDidLoad
> {
> // Produces near white background with no transparency.
> NSColor *color = [NSColor colorWithRed:0.6 green:0.6 blue:0.6 alpha:0.9];
> self.window.backgroundColor = color;
> }
>
> The first case produces a background with transparency.
>
> The second case produces a background with no transparency.
>
> Why does’t the second case yield any transparency?
I can't explain the differences in the two cases, but are you also setting the window's opaque property to NO? If not, then setting the background color to partially transparent is not sufficient to reliably make a window transparent.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden