Sve*_*eta 1 iphone animation objective-c rotation
我将箭头旋转了45度.动画结束时,箭头返回其原始状态(0度).我需要箭头不会返回到原始状态,并且在动画结束时它将旋转45度.
CABasicAnimation *fullRotationShort = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotationShort.fromValue = [NSNumber numberWithFloat:0];
fullRotationShort.toValue = [NSNumber numberWithFloat:M_PI/28*4.7];
fullRotationShort.duration = 1.0f;
fullRotationShort.repeatCount = 1;
[imgViewArrowShort.layer addAnimation:fullRotationShort forKey:nil];
Run Code Online (Sandbox Code Playgroud)
假设你的箭头是一个UIImageView名字arrow.
你真的不需要这么复杂的CAAnimations.
[UIView animateWithDuration:1.0 animations:^{
arrow.transform = CGAffineTransformMakeRotation(0.25 * M_PI);
}];
Run Code Online (Sandbox Code Playgroud)