如何设置一个NSView隐藏与可爱的FadeOut动画? [英] How to set a NSView hidden with FadeOut animation in cocoa?
本文介绍了如何设置一个NSView隐藏与可爱的FadeOut动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码从CustomView元素隐藏子视图:
I'm hiding a subview from a CustomView element with the following code:
[[[theViewcont subviews] objectAtIndex:0] setHidden:TRUE]
在隐藏此NSVIEW时添加淡入淡出动画?
how can i add a fade animation on hiding this NSVIEW?
推荐答案
找到解决方案 HERE CocoaDev:CoreAnimation
Found the solution HERE CocoaDev:CoreAnimation
所以当你有这样的东西隐藏你的subview: / p>
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];
所以你有正确的方法来淡出一个子视图Cocoa
so there you have the right way to 'fade out' a subview con Cocoa
这篇关于如何设置一个NSView隐藏与可爱的FadeOut动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文