Why isn't MKMapView
loading overlays, if it's the initial start (right after deployment) of the app and the MKMapView
is in the first View?
Afterwards everything works fine, even if it's the initial start of the app and the MKMapView
is not the first view.
The following delegates are not being called:
mapView: viewForOverlay:
mapView: viewForAnnotation:
I'm using SDK 5.1 and Storyboard for the UI.
Since the data for the overlays is not available right after the initial start, it's not available for drawing either.
Update Approach:
Instead of just adding the objects only in viewDidLoad I switched it to a more dynamic approach.
The most obvious way of doing this is to use NSFetchedResultController
, known from UITableViewController
. It has a handy delegate which calls my viewcontroller if something changed.
So from now I only implement the delegate methods and then update, remove or delete the overlays from the MKMapView
.