For an app I\'m building, I have a custom \"old map\" effect PNG that I\'d like to overlay on the MKMapView view. Unfortunately, neither way I\'ve tried to do this is exactly ri
It's pretty old, but maybe still relevant for some of you.
I wanted to make the map darker, but not the annotation views.
What i did was very simple and i don't yet know if it has some fallbacks...
I put a UIView
with a black-transparent background above the MKMapView
, and then added the following code:
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
{
for (MKAnnotationView *view in views) {
view.center = [self.mapView convertCoordinate:view.annotation.coordinate toPointToView:self.viewDark];
[self.viewDark addSubview:view];
}
}
Hope it helps.. and of course - if you find any issues about this solution please let me know :)
Edit #1:
Forgot to mention that self.viewDark
should have userInteraction
disabled.
Edit #2:
Another thing that helped me is setting self.viewDark
's autoresizesSubviews
to NO
.