Reputation: 837
In my app I have a mapkit view and right when the app starts it zooms into the users locationsmapView.setUserTrackingMode(MKUserTrackingMode.follow, animated: true)
, but when I run this code it zooms into the users location but I want to zoom more closer into the users location. How would I do this?
Upvotes: 1
Views: 375
Reputation: 2343
You can set the regionRadius
according to your needs.
let regionRadius: CLLocationDistance = 1000
func centerMapOnLocation(_ location: CLLocation) {
let coordinateRegion = MKCoordinateRegionMakeWithDistance(location.coordinate, regionRadius, regionRadius)
mapView.setRegion(coordinateRegion, animated: true)
}
Where location.coordinate
is the coordinate where you want to zoom in.
Upvotes: 2