self.locationTimer =[NSTimer scheduledTimerWithTimeInterval: 0.01 target: self selector:@selector(transformAction) userInfo: nil repeats: YES];
-(void)transformAction {
angle = angle – 0.1;//angle角度 double angle;
if (angle < -6.28) {//大于 M_PI*2(360度) 角度再次从0开始
angle = 0;
}
CGAffineTransform transform=CGAffineTransformMakeRotation(angle);
self.animationImageView.transform = transform;
}
然后再在特定的地方使用
//关闭定时器
[self.locationTimer setFireDate:[NSDate distantFuture]];
//开启定时器
[self.locationTimer setFireDate:[NSDate distantPast]];
版权声明:欢迎转载,请注明出处:蜗牛爱课 • 移动互联网