在我的应用程序中,我有一个mapkit视图,当应用程序启动时,它会缩放到用户位置(mapView.setUserTrackingMode(MKUserTrackingMode.follow, animated: true)),但是当我运行这段代码时,它会缩放到用户位置,但我想放大更接近用户位置。我该怎么做?
发布于 2017-08-04 17:24:04
您可以根据需要设置regionRadius。
let regionRadius: CLLocationDistance = 1000
func centerMapOnLocation(_ location: CLLocation) {
let coordinateRegion = MKCoordinateRegionMakeWithDistance(location.coordinate, regionRadius, regionRadius)
mapView.setRegion(coordinateRegion, animated: true)
}其中location.coordinate是你想放大的坐标。
https://stackoverflow.com/questions/45511928
复制相似问题