Re: Layer hosting custom NSView and setAlphaValue
Re: Layer hosting custom NSView and setAlphaValue
- Subject: Re: Layer hosting custom NSView and setAlphaValue
- From: Kyle Sluder <email@hidden>
- Date: Mon, 14 May 2012 10:49:40 -0700
On May 14, 2012, at 9:52 AM, Markus Spoettl wrote:
> On 5/14/12 6:10 PM, Corbin Dunn wrote:
>>> I have a layer hosting custom view which I can't convince to listen to the
>>> alpha value I set on its superview. Other views sitting on the same
>>> superview correctly fade with the alpha value of the superview changing. My
>>> view doesn't. It simply hides when the superview's alpha is less than 1.
>>>
>>> Not sure what the problem is, the documentation for setAlphaValue doesn't
>>> tell me a lot, neither does the view programming guide.
>>>
>>> Any ideas?
>>
>> Hi Markus, It sounds like the parent view which you are setting the
>> alphaValue on is not layer backed, but you do apparently have a layer backed
>> child. That won't work; make the parent layer backed.
>
> Hi Corbin, thanks and sorry for not being clearer, this is my hierarchy:
>
> container (NSView)
> |
> - button 1 (NSButton)
> - button 2 (NSButton)
> - Custom View (NSView subclass, layer-hosting).
>
> I'm setting the container's alpha value, which fades both buttons, but not my layer hosting custom view.
>
> My only guess is that there's something I need to do in my custom view but I have no idea what that is.
I think you need to manually animate the alpha value of your layer-hosting view's layer.
When you're layer-hosting, AppKit doesn't muck with your layers. As long as you perform the fade of your layer-hosting view's layer within the same animation context as the animation of your superview's alpha, you should be good to go.
I don't know whether I'd consider your scenario a bug.
--Kyle Sluder
_______________________________________________
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