0
[animationImageView setWantsLayer:YES];

CAKeyframeAnimation *keyframeAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];    
keyframeAnimation.values = [animationsBindingsController valueForKeyPath:@"selection.controlPoints"];
keyframeAnimation.duration = 5;
[animationImageView.layer addAnimation:keyframeAnimation forKey:@"position"];
[pageContent addSubview:animationImageView];

AnimationImageView是 的子类NSImageView

animationImageView对象消失 5 秒(动画持续时间),然后突然出现在初始位置。

4

1 回答 1

0

好的,我没有继承 NSImageView,而是继承了 CALayer(通过方法 setContents:你可以设置 NSImage)。核心动画完美运行!

于 2011-10-16T09:41:04.773 回答