如何将MKMapPoint转换为CGPoint

Sra*_*van 0 mkmapview ipad ios ios5

任何人都可以解释如何将MKMapPoint转换为CGPoint吗?我需要在UIView上使用纬度和经度绘制路径.

pni*_*zle 15

接受的答案将CLLocationCoordinate2D转换为CGPoint,这不是实际问题中提出的问题.对于那些在这里寻找完整答案的人来说:

MKMapPoint mapPoint = MKMapPointMake(22.1, 34.4);//example

//first convert MKMapPoint to CLLocationCoordinate2D
CLLocationCoordinate2D mapPointCoordinate = MKCoordinateForMapPoint(mapPoint);

//second convert CLLocationCoordinate2D to CGPoint
CGPoint pointAsCGPoint = [self.mapView convertCoordinate: mapPointCoordinate toPointToView: self.mapView];
Run Code Online (Sandbox Code Playgroud)