MKMapSnapshotter가 당신이 원하는 것입니다.
let options = MKMapSnapshotOptions()
options.region = mapView.region
options.size = mapView.frame.size
options.scale = UIScreen.mainScreen().scale
let fileURL = NSURL(fileURLWithPath: "path/to/snapshot.png")
let snapshotter = MKMapSnapshotter(options: options)
snapshotter.startWithCompletionHandler { snapshot, error in
guard let snapshot = snapshot else {
print("Snapshot error: \(error)")
return
}
let data = UIImagePNGRepresentation(snapshot.image)
data?.writeToURL(fileURL, atomically: true)
}
this NSHipster 게시물을 확인 MKMapSnapshotter에 대한 자세한 내용을 읽기에 관심이 경우 : 여기 스위프트의 예입니다. 게시물에는 이미지에 주석을 그리는 방법의 예가 있습니다. 이전에 앱에서 사용한 주석은 잘 작동합니다.
희망 하시겠습니까?
'MKMapSnapshotter' – dan
와우를 사용할 수 있습니다. 놀랄 만한. 완벽 해. 어떻게 출력합니까? –
위의 그림은 lat/lng 좌표와 이미지의 점 사이를 변환 할 수있는 몇 가지 추가 기능이있는'UIImage'를 감싸는 래퍼 인'MKMapSnapshot' 객체를 제공합니다. – dan