Ios Objective-c-当地图更新其自身时,停止集中用户位置

Ios Objective-c-当地图更新其自身时,停止集中用户位置,ios,Ios,我用MapKit框架创建了一个简单的应用程序。启动时,将放大并显示用户位置。但当我缩小并滚动地图时,它会在几秒钟后自动将其自身集中到用户位置。我怎样才能阻止这一切 在m文件中: #import "APPNAMEViewController.h" #import <MapKit/MapKit.h> @synthesize mapview; - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocati

我用MapKit框架创建了一个简单的应用程序。启动时,将放大并显示用户位置。但当我缩小并滚动地图时,它会在几秒钟后自动将其自身集中到用户位置。我怎样才能阻止这一切

在m文件中:

#import "APPNAMEViewController.h"
#import <MapKit/MapKit.h>

@synthesize mapview;

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)aUserLocation     {
    mapView.scrollEnabled = YES;
    mapView.zoomEnabled = YES;
    MKCoordinateRegion region;
    MKCoordinateSpan span;
    span.latitudeDelta = 0.005;
    span.longitudeDelta = 0.005;
    CLLocationCoordinate2D location;
    location.latitude = aUserLocation.coordinate.latitude;
    location.longitude = aUserLocation.coordinate.longitude;
    region.span = span;
    region.center = location;
    [mapView setRegion:region animated:NO];
    [mapView setUserTrackingMode:MKUserTrackingModeNone animated:NO];
}
- (void)viewDidLoad
{
     [super viewDidLoad];
     mapview = [[MKMapView alloc]
           initWithFrame:CGRectMake(0,
                                    44,
                                    self.mapview.bounds.size.width,
                                    self.mapview.bounds.size.height)
           ];
     mapview.showsUserLocation = YES;
     mapview.mapType = MKMapTypeStandard;
     mapview.delegate = self;
     [mapview setUserTrackingMode:MKUserTrackingModeNone animated:NO];

     [self.view addSubview:mapview];
}
#导入“APPNAMEViewController.h”
#进口
@综合地图视图;
-(void)mapView:(MKMapView*)mapView didUpdateUserLocation:(MKUserLocation*)aUserLocation{
mapView.scrollEnabled=是;
mapView.ZoomeEnabled=是;
协调区域;
Mk坐标跨度;
span.latitudeDelta=0.005;
span.longitudeDelta=0.005;
CLLOCATION坐标2D定位;
location.latitude=aUserLocation.coordinate.latitude;
location.longitude=aUserLocation.coordinate.longitude;
region.span=span;
region.center=位置;
[地图视图设置区域:区域动画:否];
[mapView setUserTrackingMode:MKUserTrackingModeNone动画:否];
}
-(无效)viewDidLoad
{
[超级视图下载];
mapview=[[MKMapView alloc]
initWithFrame:CGRectMake(0,
44,
self.mapview.bounds.size.width,
self.mapview.bounds.size.height)
];
mapview.showsUserLocation=是;
mapview.mapType=MKMapTypeStandard;
mapview.delegate=self;
[mapview setUserTrackingMode:MKUserTrackingModeNone动画:否];
[self.view addSubview:mapview];
}
请帮帮我:)

致意
Michal

删除
[mapView设置区域:区域动画:否]
-(void)mapView:(MKMapView*)mapView didUpdateUserLocation:(MKUserLocation*)aUserLocation中删除:[mapView setUserTrackingMode:MKUserTrackingModeNone动画:否]

[mapView setRegion:region animated:NO]; //Changes the currently visible region and optionally animates the change.
这将使地图位于当前位置的中心