-(void)timed{
timers=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(mytimer) userInfo:nil repeats:YES];
}
-(void)mytimer{
count ++;
int x=self.view.frame.size.width;
int y=self.view.frame.size.height;
int number=arc4random()%x;
int bbbb=arc4random()%y;
int hahahh=(arc4random()%80)+30;
UIImageView * _loadingView = [[UIImageView alloc]initWithFrame:CGRectMake(number-hahahh,bbbb-hahahh, hahahh, hahahh)];
_loadingView.image = [UIImage imageNamed:@"rotating"];
[self.view addSubview:_loadingView];
CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
rotationAnimation.duration = 2;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = 100000;
[_loadingView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
[self performSelector:@selector(closed:) withObject:_loadingView afterDelay:1];
// if (count+=2) {//这里怎么判断
// [_loadingView.layer removeAnimationForKey:@"rotationAnimation"];
// [_loadingView removeFromSuperview];
//
// }
}
-(void)closed:(UIImageView *)imageView{
[imageView removeFromSuperview];
}