MKMap 不从 OverlayRenderer 请求超过 3 个纵向图块
MKMap not requesting more than 3 longitudinal tiles from OverlayRenderer
我使用了 apples breadcrumb 示例,对其进行了调整并在我的代码中产生了奇怪的效果。
- (void)drawMapRect:(MKMapRect)mapRect
zoomScale:(MKZoomScale)zoomScale
inContext:(CGContextRef)context
调用时使用尽可能多的瓦片来覆盖南北,但从不要求从东到西超过 3 个瓦片。所以它永远不会覆盖广泛的覆盖层。
图块内的所有内容都已正确绘制等。即使使用
,地图也不会再调用任何请求
- (BOOL)intersectsMapRect:(MKMapRect)mapRect {
return YES;
}
中心坐标正好在边界的中间。
// init of CrumbPath : NSObject <MKOverlay>
upper = CLLocationCoordinate2DMake(49.0, 10.0);
lower = CLLocationCoordinate2DMake(48.0, 5.0);
_coordinate = CLLocationCoordinate2DMake(48.5, 7.5);
MKMapPoint upperLeft = MKMapPointForCoordinate(upper);
MKMapPoint lowerRight = MKMapPointForCoordinate(lower);
_boundingMapRect = MKMapRectMake(upperLeft.x,
upperLeft.y,
lowerRight.x - upperLeft.x,
lowerRight.y - upperLeft.y);
MapKit 无法处理负尺寸的 MKMapRect。来自和到 CGRects 的所有计算和绘图 WORK 但地图本身不会请求正确的 MapRects 如果大小为负,因为它将它们视为大小 0.
所以 'abs' 会起作用
_boundingMapRect = MKMapRectMake(upperLeft.x,
upperLeft.y,
fabs(lowerRight.x - upperLeft.x),
fabs(lowerRight.y - upperLeft.y));
我使用了 apples breadcrumb 示例,对其进行了调整并在我的代码中产生了奇怪的效果。
- (void)drawMapRect:(MKMapRect)mapRect
zoomScale:(MKZoomScale)zoomScale
inContext:(CGContextRef)context
调用时使用尽可能多的瓦片来覆盖南北,但从不要求从东到西超过 3 个瓦片。所以它永远不会覆盖广泛的覆盖层。
图块内的所有内容都已正确绘制等。即使使用
,地图也不会再调用任何请求- (BOOL)intersectsMapRect:(MKMapRect)mapRect {
return YES;
}
中心坐标正好在边界的中间。
// init of CrumbPath : NSObject <MKOverlay>
upper = CLLocationCoordinate2DMake(49.0, 10.0);
lower = CLLocationCoordinate2DMake(48.0, 5.0);
_coordinate = CLLocationCoordinate2DMake(48.5, 7.5);
MKMapPoint upperLeft = MKMapPointForCoordinate(upper);
MKMapPoint lowerRight = MKMapPointForCoordinate(lower);
_boundingMapRect = MKMapRectMake(upperLeft.x,
upperLeft.y,
lowerRight.x - upperLeft.x,
lowerRight.y - upperLeft.y);
MapKit 无法处理负尺寸的 MKMapRect。来自和到 CGRects 的所有计算和绘图 WORK 但地图本身不会请求正确的 MapRects 如果大小为负,因为它将它们视为大小 0.
所以 'abs' 会起作用
_boundingMapRect = MKMapRectMake(upperLeft.x,
upperLeft.y,
fabs(lowerRight.x - upperLeft.x),
fabs(lowerRight.y - upperLeft.y));