【发布时间】:2011-10-28 21:45:25
【问题描述】:
我正在从对 iPhone 编程过渡到原生 Mac 应用程序。我想念的一件事是 UIView 动画系统的简单性。
对于 UIView 子类,我有以下两种方法:
-(void) hide{
_isHidden=YES;
[UIView commitAnimations];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.5];
self.alpha = 0;
[UIView commitAnimations];
}
-(void) show{
_isHidden=NO;
[UIView commitAnimations];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:0.5];
self.alpha = 1;
[UIView commitAnimations];
}
现在我不确定如何在 Cocoa 中实现这一点。我尝试了以下方法,但我不确定它是否可以正常工作。
-(void) hide{
[[_myView animator] setAlpha:0];
}
我有时会在淡入淡出功能仍在运行时多次调用此功能(隐藏)。
【问题讨论】:
标签: objective-c cocoa animation uikit