首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MKPolyline boundingMapRect插图

MKPolyline boundingMapRect插图
EN

Stack Overflow用户
提问于 2018-12-16 04:26:12
回答 1查看 373关注 0票数 0

如何将插图添加到MKPolylineboundingMapRect中,以便在MKMapSnapshotter中使用?

代码语言:javascript
复制
    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
    }
EN

回答 1

Stack Overflow用户

发布于 2018-12-17 19:36:18

您可以向地域添加span,如下所示:

代码语言:javascript
复制
// This will add a 10% increase in the span.
var region = MKCoordinateRegion(polyLine.boundingMapRect)
region.span.latitudeDelta = 1.1
region.span.longitudeDelta = 1.1

编辑:

这也是另一种选择:

代码语言:javascript
复制
let region = polyLine.boundingMapRect
map.setVisibleMapRect(region, edgePadding: UIEdgeInsets(top: 50.0, left: 50.0, bottom: 50.0, right: 50.0), animated: true)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53796976

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档