2011-08-03 30 views
0

我有一个应用程序显示地图。我需要显示的用户当前位置,并能做到与在应用程序的地图上的GPS位置

[mapView setShowsLocation:YES];

但是,当我放大或缩小地图,它需要大量的时间,再次告诉我,蓝脚。

这是正常的,或者我需要把其他东西,以保持屏幕上的蓝色的所有时间???

谢谢。

回答

1
[self setCurrentLocation:self._mapView.userLocation.location.coordinate withZoom:1.0]; 
self._mapView.showsUserLocation = YES; 

- (void)setCurrentLocation:(CLLocationCoordinate2D)coord withZoom:(float)zoomLevel { 
    MKCoordinateRegion region = self._mapView.region; 
    region.span.latitudeDelta = self.defaultSpanLevel.latitudeDelta*zoomLevel; 
    region.span.longitudeDelta = self.defaultSpanLevel.longitudeDelta*zoomLevel; 
    region.center = coord; 
    [self._mapView setRegion:region animated:YES]; 
} 

您可以使用此视图中会出现方法

那么你可以使用MapView的委托方法....

区域没有改变动画:是{并设置地图的区域在这里。 ......采取 当前用户的位置为中心的区域..}

这将解决你的问题

}

+0

是的,但每个解决方案的工作原理都与之前相同。我得到蓝色的针,当我放大或缩小它消失,然后再...可怕的... – Akosha

相关问题