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];
}
私を助けてください :)
よろしくミハル