Iphone 将MK圆半径转换为CoreGraphics圆弧半径
如何将MKCircle的半径(以米为单位)转换为可以使用MkOverlyPathView子类中的核心图形绘制圆的值 在下面的代码中,半径被硬编码为50,但我需要它来反映圆的半径 对于位置,我使用MKMapPointForCoordinate()将MKCircle的坐标转换为MKMapPoint,然后使用MKOverlayPathView的pointForMapPoint将MKMapPoint转换为点:。但是如何将圆的半径转换为相对距离呢Iphone 将MK圆半径转换为CoreGraphics圆弧半径,iphone,ios,core-graphics,mapkit,mkoverlay,Iphone,Ios,Core Graphics,Mapkit,Mkoverlay,如何将MKCircle的半径(以米为单位)转换为可以使用MkOverlyPathView子类中的核心图形绘制圆的值 在下面的代码中,半径被硬编码为50,但我需要它来反映圆的半径 对于位置,我使用MKMapPointForCoordinate()将MKCircle的坐标转换为MKMapPoint,然后使用MKOverlayPathView的pointForMapPoint将MKMapPoint转换为点:。但是如何将圆的半径转换为相对距离呢 MKCircle *circle = [self circ
MKCircle *circle = [self circleForLocation:location];
CGPoint relativePoint = [self pointForMapPoint:MKMapPointForCoordinate(circle.coordinate)];
float radius = 50;
//Fill
[self applyFillPropertiesToContext:context atZoomScale:zoomScale];
CGContextAddArc(context, relativePoint.x, relativePoint.y, radius, 0, 2*3.1415926535898, 1);
CGContextDrawPath(context, kCGPathFill);
mk圆的
boundingMapRect
的高度和宽度应等于圆的直径:
CGRect boundingRect = [self rectForMapRect:circle.boundingMapRect];
CGFloat radius = boundingRect.size.width / 2;