簡體   English   中英

如何通過調整縮放級別將所有坐標包含在MapBox中?

[英]How can I include all the coordinates in the MapBox by adjusting the zoom level?

我使用的代碼是:

let bounds = MGLCoordinateBounds(
    sw: CLLocationCoordinate2D(latitude: 40.7115, longitude: 10.3725),
    ne: CLLocationCoordinate2D(latitude: 40.7318, longitude: 10.4222))
    mapView.setVisibleCoordinateBounds(bounds, animated: false)

我有3個注釋,我想通過調整縮放級別在mapBox中看到3個注釋。 請幫我找出來。

您可以使用MGLMapView上的方法:

func showAllAnnotations() {
    guard let annotations = mapView.annotations else { return }

    // Either this...
    mapView.showAnnotations(annotations, edgePadding: UIEdgeInsets(top: 40, left: 35, bottom: 35, right: 35), animated: true)
    // or this.
    mapView.showAnnotations(annotations, animated: true)
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM