So, I am fairly new to iOS programming, and have inherited a project from a former coworker. We are building an app that contains a gauge UI. When data comes in, we want to smoothly rotate our layer (which is a needle image) from the current angle to a new target angle. Here is what we have, which worked well with slow data: -(void) MoveNeedleToAngle:(float) target { static float old_Value = 0.0; CABasicAnimation *rotateCurrentPressureTick = [CABasicAnimation animationWithKeyPath:@transform.rotation); [rotateCurrentPressureTick setDelegate:self]; rotateCurrentPressureTick.fromValue = [NSSNumber numberWithFloat:old_value/57.2958]; rotateCurrentPressureTick.removedOnCompletion=NO; rotateCurrentPressureTick.fillMode=kCAFillModeForwards; rotateCurrentPressureTick.toValue=[NSSNumber numberWithFloat:target/57.2958]; rotateCurrentPressureTick.duration=3; // constant 3 second sweep [imageView_Needle.layer addAnimation:rotateCurrentPressureTick forKey:@rotateTick]; old_Value = target; }The problem is we have a new dat
2
0
4.4k