I have the following problem:
I have a \"drawn map\" (image) which I add to the MapView as an Overlay. No Problem with that.. but I need to limit the MapView to the
By implementing :
-(void) mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
You should be able to reset region to your specific one.
Look at that answer to have an example of how to do this.
Another solution, that brings more precise events but is more complex (I'm currently using this successfully for another need) is to subclass MKMapView and override UIScrollViewDelegate protocol.
If you do that, make sure to call super implementation like that :
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
if ([super respondsToSelector:@selector(scrollViewWillBeginDragging:)])
[super scrollViewWillBeginDragging:scrollView];
// do what you want
}
Note: While the protocol is public, MKMapView implementation is unknown and might differ with iOS versions, so it is more safe to check with respondsToSelector: before. You must call super implementations or Map will just not work properly.