NSTimer não disparado quando o evento uiscrollview ocorre
Eu tenho um UIImageView colocado no UIScrollView. Basicamente, este UIImageView contém um mapa muito grande e criou animação em um caminho predefinido com direção de navegação apontada por "setas".
Mas, sempre que ocorrer algum evento, acho que o MainLoop congela e o NSTimer não é acionado, e a animação é interrompid
Existe alguma propriedade existente que resolva esse problema no UIScrollView, CAKeyFrameAnimation ou NSTime
//viewDidLoad
self.myTimer = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(drawLines:) userInfo:nil repeats:YES];
- (void)drawLines:(NSTimer *)timer {
CALayer *arrow = [CALayer layer];
arrow.bounds = CGRectMake(0, 0, 5, 5);
arrow.position = CGPointMake(line.x1, line.y1);
arrow.contents = (id)([UIImage imageNamed:@"arrow.png"].CGImage);
[self.contentView.layer addSublayer:arrow];
CAKeyframeAnimation* animation = [CAKeyframeAnimation animation];
animation.path = path;
animation.duration = 1.0;
animation.rotationMode = kCAAnimationRotateAuto; // object auto rotates to follow the path
animation.repeatCount = 1;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
animation.fillMode = kCAFillModeForwards;
[arrow addAnimation:animation forKey:@"position"];
}