2013-10-23 5 views
0

어떻게 MKPolylines와 같은 오버레이로 MKMapView의 UIImage를 가져 옵니까? renderInContext와 MKMapSnapshotter를 시도했지만 생성 된 이미지에지도와 그 오버레이를 포함하지 않았습니다. renderInContext는 iOS 7에서 전혀 작동하지 않습니다.MKMapView에서 오버레이로 UIImage로

답변

2

documentation for the MKMapSnapshotter class에 따르면 오버레이 및 주석은 제작 된 스냅 샷에 포함되지 않습니다. documentation for the MKMapSnapshot class에 따르면 pointForCoordinate을 사용하여 수동으로 스냅 샷 이미지에 오버레이와 주석을 그릴 수 있습니다.

또한 renderInContext 코드를 게시 할 수 있습니다. 다른 방법이

– snapshotViewAfterScreenUpdates: // Captures view as a snapshot view, which may allow you to draw an image using renderInContet. 
– resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets: // Similar to the previous method, except using a rect. 
– drawViewHierarchyInRect:afterScreenUpdates: // Draws the entire view hierarchy, so this may allow you to capture subviews. 
+0

내 질문은 : --Edit--

는 아이폰 OS 7, 그들은 당신이 renderInContext 방법을 함께 시도 할 수 있습니다 다음과 같은 세 가지 새로운 방법을 추가 이 두 가지 방법 이외에 그것을 할 수 있습니다. – smartfuse

+0

@smartfuse 내 수정 된 답변보기 또한 renderInContext 메소드 코드를 게시하십시오. 나는 iOS 7 (맵보기가 아닌)이지만 그것을 잘 사용하고 있습니다. – Kamaros

+0

UIImage에서 수동으로 선을 그려보기로했습니다. 그래도 고마워. – smartfuse