Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

[[[theViewcont subviews] objectAtIndex:0] setHidden:TRUE]

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

like image 883
Mr_Nizzle Avatar asked Oct 11 '10 16:10

Mr_Nizzle


1 Answers

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.

like image 88
Mr_Nizzle Avatar answered Sep 22 '22 02:09

Mr_Nizzle