新编码器尝试在我看来适合 GoogleMap。
我搜索了很多信息,得出了这个结论,但它对我不起作用。
覆盖 func loadView() {
var markerList = [GMSMarker]()
// Create a GMSCameraPosition
let camera = GMSCameraPosition.camera(withLatitude: 4.390205, longitude: 2.154007, zoom: 8)
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
mapView.isMyLocationEnabled = true
view = mapView
mapView.settings.myLocationButton = true
//mapView.setMinZoom(10, maxZoom: 20)
//create markers
for loc in arrayOfMapStops {
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: loc.lat, longitude: loc.long)
marker.title = loc.address
marker.snippet = loc.type
if loc.type == "Entrega" {marker.icon = GMSMarker.markerImage(with: .green)}
else {marker.icon = GMSMarker.markerImage(with: .blue)}
marker.map = mapView
markerList.append(marker)
}
//fit map to markers
var bounds = GMSCoordinateBounds()
for marker in markerList {
bounds = bounds.includingCoordinate(marker.position)
}
let update = GMSCameraUpdate.fit(bounds)
mapView.moveCamera(update)
}
地图未使用适当的缩放进行调整。
任何人都可以帮助我解决缩放问题吗?
提前致谢 :)