开发者

Core Animation doesn't work. Object disappears

开发者 https://www.devze.com 2023-04-13 09:50 出处:网络
[animationImageView setWantsLayer:YES]; CAKeyframeAnimation *keyframeAnimation = [CAKeyframeAnimation animationWithKeyPath:@\"position\"];
[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 is a subclass of NSImageView.

animationImageView object disappears for a 5 seconds (for a duration of animation), and suddenly it appears in init position.


Ok, Instead of subclassing NSImageView, I subclassed CALayer (by method setContents: you can set NSImage). Core Animation works perfectly!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号