如何缩放到当前用户位置?

时间:2014-03-02 08:34:19

标签: ios mkmapview mapkit mkuserlocation

我想在中心显示当前用户位置,并且还希望在当前位置的所有方向上显示15km距离。如何实现?

1 个答案:

答案 0 :(得分:1)

以下是如何操作:

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

    [self setRegion:MKCoordinateRegionMakeWithDistance(locationCoordinate2D, distance, distance)
           animated:animated];
}