【发布时间】:2011-12-04 04:55:14
【问题描述】:
我有一种方法可以移动地图,使其跟随当前用户位置。这很好用,但目前缩放比例不能按我想要的方式工作。我希望用户能够按照他们想要的方式缩小或放大地图,并且仍然让它跟随用户刚刚在地图上设置的新缩放比例的当前位置。
我尝试执行以下操作,但效果不佳:
/**
* Centers the map on the current location
*
* @version $Revision: 0.1
*/
- (void)centerMapOnLocation:(CLLocation *)location {
// Make a region using our current zoom level
CLLocationDistance latitude = mapView.region.span.latitudeDelta*100;
CLLocationDistance longitude = mapView.region.span.longitudeDelta*100;
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(location.coordinate, latitude, longitude);
[mapView setRegion:region animated:YES];
}//end
【问题讨论】:
标签: iphone ios mkmapview core-location