-2
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
CGRect frame = [button frame];
button.layer.anchorPoint = CGPointMake(0.5, 0.5);
button.layer.position = CGPointMake(frame.origin.x + 0.5 * frame.size.width, frame.origin.y + 0.5 * frame.size.height);
[CATransaction commit];
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanFalse forKey:kCATransactionDisableActions];
[CATransaction setValue:[NSNumber numberWithFloat:2.0] forKey:kCATransactionAnimationDuration];
CABasicAnimation *animation;
animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
animation.fromValue = [NSNumber numberWithFloat:0.0];
animation.toValue = [NSNumber numberWithFloat:2 * M_PI];
animation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionLinear];
animation.delegate = self;
[button.layer addAnimation:animation forKey:@"rotationAnimation"];
[CATransaction commit];
我想这码BT没有用,我想移动图像视图在圆形路径图像视图
BT上面的代码将通过其中心旋转图像视图,W想要的图像以沿任意点 – Amrut
HI阿尼尔旋转,我需要图像视图不断朝这个方向移动 – Amrut