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里面 为什么动画就没有效果了呢?
求教~~~