Reputation: 6353
I have a mapView and I use didUpdateLocations to show location user, but I also use setCenterCoordinate to show the pin blue circle predeterminate for show the location in left of the mapView. But if I use setCenterCoordinate the map not does zoom...
churchLocation.longitude += self.mapView.region.span.longitudeDelta * 0.15;
churchLocation.latitude += self.mapView.region.span.latitudeDelta * 0.10;
self.mapView.setRegion(theRegion, animated: true)
self.mapView.setCenterCoordinate(churchLocation, animated: true)
How can I do this?
Thanks!
Upvotes: 1
Views: 744
Reputation: 8304
setRegion
and setCenterCoordinate
are going to work against each other. The view will be looking at the center of theRegion
, then you're trying to move it to look at churchLocation
.
If you want to set both the zoom level and the you should use the churchLocation
and calculate a region around it and then call setRegion
with that.
Upvotes: 1