[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秒(动画持续时间),突然出现在初始位置。
答案 0 :(得分:0)
好的,我没有子类化NSImageView,而是继承了CALayer(通过方法setContents:你可以设置NSImage)。核心动画完美无缺!