核心动画不起作用。对象消失了

时间:2011-10-15 11:32:34

标签: cocoa core-animation nsimageview

[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];

AnimationImageViewNSImageView的子类。

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

1 个答案:

答案 0 :(得分:0)

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