我使用的代码是:
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)
}