How can I check if a map is loaded into MKKapview ? I mean... asking the map view to be ready - and not waiting for notification mapViewDidFinishLoadingMap:
which doesn't notify if it is already buffered ?
My usecase for better understanding the problem: My App should print a map which is created in the background, using MKMapview. Loading the map can take a while, so without checking the readyness, the map will be incomplete. This can clearly be seen in the preview. Using mapViewDidFinishLoadingMap:
helps for the first time. But if I print again just with a slightly different region, I will not get the notification.
This is my code snippest
-(IBAction)print:(id)sender {
[self prepareClonedMap];
}
-(void) prepareClonedMap {
[self cloneMap:scaling];
// I would like here ... if ( mapIsReady ) [self executePrint];
}
-(void)mapViewDidFinishLoadingMap:(MKMapView *)mapView {
[self executePrint];
}
-(void)executePrint {
// make MKMapSnapshot
// create printoperation
.....
}
-(void)cloneMap:(CGFloat) factor {
NSRect myframe;
// expand to max factor
myframe=mapView.frame;
myframe.size.height = myframe.size.height * factor,
myframe.size.width = myframe.size.width * factor;
// reduce to max dimensions
myframe.size = [self maxDimensionWithRatio:myframe.size];
[cloneView setFrame:myframe];
[cloneView setRegion:[mapView region]];
}