Ios MapKit MKOverlayView animation happens instantly

I am trying to animate the alpha value of a MapKit overlay (specifically MKCircleView) in iOS 5 using the following code:

-(void) animateCircle:(MKCircle*)circle onMap:(MKMapView*) mapView { MKCircleView * circleView = (MKCircleView*) [mapView viewForOverlay:circle]; UIViewAnimationOptions options = UIViewAnimationOptionCurveEaseInOut|UIViewAnimationOptionTransitionNone; [UIView animateWithDuration:5.0 delay:0.0 options:options animations:^(void) { circleView.alpha = 0.9; } completion:^(BOOL finished) {} ]; } 

The alpha value of the overlay changes as I want, but it jumps there instantly, rather than animating for the specified duration.

Can anyone suggest what might be wrong? Perhaps the animation on overlay views is more complicated with blocks than I thought.

+6
source share
1 answer

Core Animation has an interesting behavior when parallel animations affect the same view ... If you try to animate a view before completing the last animation of the view, it is assumed that you expected the subsequent animation to start from the desired final state as the original. This can lead to frame jumps as well as alpha transitions.

In your case, this representation is most likely animated by something else. Try to find and remove another animation / or in UIViewAnimationOptionBeginFromCurrentState with its parameters.

0
source

Source: https://habr.com/ru/post/900846/


All Articles