你如何旋转UIView
, UIImageView
or CALayer
不使用 OpenGL ES 进行 360 度动画?
#import <QuartzCore/QuartzCore.h>
CABasicAnimation *fullRotation;
fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotation.fromValue = @(0.0);
fullRotation.toValue = @((360.0 * M_PI)/180.0);
fullRotation.duration = 3.5f;
fullRotation.repeatCount = MAXFLOAT;
[view.layer addAnimation:fullRotation forKey:@"rotation-animation"];
如果你想改变它旋转的锚点,那么你可以这样做
CGRect frame = view.layer.frame;
self.anchorPoint = CGPointMake(0.5, 0.5); // rotates around center
self.frame = frame;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)