1
请你能告诉我如何旋转UIView(饼图上),就好像它在一个枢轴上。只有用户弹出视图后才会旋转。旋转枢轴上的UIView
请你能告诉我如何旋转UIView(饼图上),就好像它在一个枢轴上。只有用户弹出视图后才会旋转。旋转枢轴上的UIView
你会使用这样的:
- (void)spin
{
CABasicAnimation *fullRotation;
fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotation.fromValue = [NSNumber numberWithFloat:0];
fullRotation.toValue = [NSNumber numberWithFloat:M_PI * 360/180.0];
fullRotation.duration = 0.25;
fullRotation.repeatCount = 1;
[self.view.layer addAnimation:fullRotation forKey:@"360"];
}
仅仅调用旋方法时要旋转360度。根据需要调整以旋转更多,更少,更快,更慢等。
编辑:应该注意,在上面的代码中,view
属性是我们正在旋转的属性,以防它不明显。因此,将self.view
更改为您想要旋转的视图。