开发者

How to set a NSView hidden with FadeOut animation in cocoa?

开发者 https://www.devze.com 2023-01-19 07:57 出处:网络
I\'m hiding a subview from a CustomView element with the following code: [[[theViewcont subviews] objectAtIndex:0] setHidden:开发者_如何学PythonTRUE]

I'm hiding a subview from a CustomView element with the following code:

[[[theViewcont subviews] objectAtIndex:0] setHidden:开发者_如何学PythonTRUE]

how can I add a fade animation when hiding this NSView?


Found the solution HERE CocoaDev:CoreAnimation

so when you have something like this to hide your subview:

[[[theViewcont subviews] objectAtIndex:0] setAlphaValue:0.0];

to animate that action you just should so the following addition:

[[[[theViewcont subviews] objectAtIndex:0] animator] setAlphaValue:0.0];

so there you have the right way to 'fade out' a subview in Cocoa.

0

精彩评论

暂无评论...
验证码 换一张
取 消