Re: Transparent window and opaque objects
Re: Transparent window and opaque objects
- Subject: Re: Transparent window and opaque objects
- From: "Shawn Erickson" <email@hidden>
- Date: Wed, 24 Oct 2007 15:27:24 -0700
On 10/24/07, Lorenzo <email@hidden> wrote:
> Hi,
> I set my window with a transparent background
>
> [win setBackgroundColor:[NSColor clearColor]];
> [win setOpaque:NO];
> [win setHasShadow:NO];
> [[win contentView] addSubview:aView];
>
> The aView contains an NSImageView and some white NSTextField labels.
> The NSImageView contains a rounded corner rectangle gray image with alpha
> 0.5. My intention is to see an half a transparent rounded corner pop-up
> window with some pure-white text over.
> In IB I can quite see the half-transparent picture within the NSImageView,
> and the white text OVER the image. Instead when I launch the application,
> the white text gets multiplied (I guess) by the image alpha value and
> results in a dark gray color. What did I forget? Any idea?
The display order of sibling views is undefined in Tiger and earlier.
So you are likely getting your text fields rendered before the image
view renders.
I suggest that you consider using a custom view to render you
background image in and then add your text fields as sub-views of that
custom view.
In the short term you could try to add the text fields as subviews of
the image view (have to do that using code, IB wont help with this).
-Shawn
_______________________________________________
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