如何放大用户当前的位置?

当应用程序在MapKit中启动时,我想放大用户当前的位置。 这是我的代码(在viewDidLoad函数中):

Locate=[[CLLocationManager alloc]init]; Locate.delegate=self; Locate.desiredAccuracy=kCLLocationAccuracyBestForNavigation; Locate.distanceFilter=kCLDistanceFilterNone; [Locate startUpdatingLocation]; [super viewDidLoad]; //Region MKCoordinateRegion myRegion; //Center CLLocationCoordinate2D center; center.latitude=Locate.location.coordinate.latitude; center.longitude=Locate.location.coordinate.longitude; //Span MKCoordinateSpan span; span.latitudeDelta=0.3f; span.longitudeDelta=0.3f; //Set Region myRegion.center=center; myRegion.span=span; [_MyMap setRegion:myRegion animated:YES]; 

我也用前面的代码实现了didUpdateLocation函数。 问题是,当用户位置正在改变(当用户正在移动)时,屏幕会放大他,但我不能移动屏幕,如果我尝试移动它立即返回到用户位置,所以我不能看到整个地图。

对于缩放地图,你必须改变区域值意味着中心和span.once看到这一个Mapview缩放

在我的情况下,我用这个移动地图,当我点击特定的button。

 MKCoordinateSpan span = MKCoordinateSpanMake(30.5982f,0.0001f); CLLocationCoordinate2D coordinate = {36, 90}; MKCoordinateRegion region = {coordinate, span}; MKCoordinateRegion regionThatFits = [self.mapView regionThatFits:region]; [self.mapView setRegion:regionThatFits animated:YES]; 

我通过添加touchesMoved函数解决了这个问题,并停止更新此函数中的位置。 解决了。