CAKeyframeAnimation 失效的疑问

rollrock1987 rollrock1987 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 50, 50)];
btn.backgroundColor = [UIColor blackColor];

[self.view addSubview:btn];

CGRect boundingRect = CGRectMake(-100, -100, 300, 300);

CAKeyframeAnimation *orbit = [CAKeyframeAnimation animation];
orbit.keyPath = @"position";
orbit.path = CFAutorelease(CGPathCreateWithEllipseInRect(boundingRect, NULL));
orbit.duration = 4;
orbit.additive = YES;
orbit.repeatCount = HUGE_VALF;
orbit.calculationMode = kCAAnimationPaced;
orbit.rotationMode = kCAAnimationRotateAuto;

[btn.layer addAnimation:orbit forKey:@"orbit"];

这个是动画的代码。

我在MainViewController 里面 直接贴上上面的代码 是可以正常运行的。
我在MainViewController里面
FirstViewController * vc = [[FirstViewController alloc]initWithNibName:nil bundle:nil];

[self presentViewController:vc animated:YES completion:^(void){

}];

present了一个 FirstViewContoller 在这个FirstViewContollr里面 为什么动画就没有效果了呢?
求教~~~
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
rollrock1987
iOS 29,038 成员 12,459 内容