I have a mapview where the annotation\'s coordinates are constantly being updated but when I use setCoordinate, the annotation does not move. How do I refresh the annotation
For dark mode purposes I needed to refresh the views of annotations. I had to call also the delegate method to recreate the view of the annotations.
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
if (@available(iOS 13.0, *)) {
if ([self.traitCollection hasDifferentColorAppearanceComparedToTraitCollection:previousTraitCollection]) {
for (id annotation in self.mapView.annotations) {
[self.mapView removeAnnotation:annotation];
[self.mapView addAnnotation:annotation];
[self mapView:self.mapView viewForAnnotation:annotation];
}
}
}
}