我的应用程序中有一个 MKMapView,有一些叠加层,显示正确。这些叠加层在内部绘制图像
- (void) drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context
MapView 允许缩放,我想避免以特定缩放级别绘制图像
有没有办法在这个方法内部确定覆盖矩形是否大于地图视图矩形?
假设您的叠加层是由myOverlay (MyOverlay *)和myOverlayView (MyOverlayView *)
在里面- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context你可以得到myOverlay这样的参考:
MyOverlay *myOverlay = (MyOverlay *)self.overlay;
myOverlay.boundingRect从这里开始比较应该很容易mapRect。