Domanda

I want to show current user location in center and also want to show 15km distance on all sides from current location. How to achieve that?

È stato utile?

Soluzione

Here is how to do it:

- (void)zoomToUserLocationAnimated:(BOOL)animated
{
    CLLocationCoordinate2D locationCoordinate2D = _locationManager.location;
    CLLocationDistance distance = 30000;

    [self setRegion:MKCoordinateRegionMakeWithDistance(locationCoordinate2D, distance, distance)
           animated:animated];
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top