ios - How to remove an annotation from a map view gently? -
i'm adding , removing annotations map view. when remove 1 disappears abruptly , looks bit startling, i'd rather faded away gracefully.
i tried removing uiview:animatewithduration: wasn't animatable attribute.
if there's no other easy solution thinking annotation view fade alpha , remove annotation map. problem doesn't seem annotation view has reference map view? adding 1 starts bit messy. there easy quick solution removing annotation gracefully?
using animatewithduration
should work fine. fade removal of annotation, 1 can:
mkannotationview *view = [self.mapview viewforannotation:annotation]; if (view) { [uiview animatewithduration:0.5 delay:0.0 options:0 animations:^{ view.alpha = 0.0; } completion:^(bool finished) { [self.mapview removeannotation:annotation]; view.alpha = 1.0; // remember set alpha 1.0 because annotation view can reused later }]; } else { [self.mapview removeannotation:annotation]; }
Comments
Post a Comment