如何将插图添加到MKPolyline的boundingMapRect中,以便在MKMapSnapshotter中使用?
let polyLine = MKPolyline(coordinates:locations , count: locations.count)
var region = MKCoordinateRegionForMapRect(polyLine.boundingMapRect)
mapSnapshotOptions.region = region
mapSnapshotOptions.scale = UIScreen.main.scale
mapSnapshotOptions.size = imageViewRect.size
mapSnapshotOptions.showsBuildings = true
mapSnapshotOptions.showsPointsOfInterest = true
let snapShotter = MKMapSnapshotter(options: mapSnapshotOptions)
snapShotter.start { (snapshot, error) in
//use snapshot
}发布于 2018-12-17 19:36:18
您可以向地域添加span,如下所示:
// This will add a 10% increase in the span.
var region = MKCoordinateRegion(polyLine.boundingMapRect)
region.span.latitudeDelta = 1.1
region.span.longitudeDelta = 1.1编辑:
这也是另一种选择:
let region = polyLine.boundingMapRect
map.setVisibleMapRect(region, edgePadding: UIEdgeInsets(top: 50.0, left: 50.0, bottom: 50.0, right: 50.0), animated: true)https://stackoverflow.com/questions/53796976
复制相似问题