0

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];
}

私を助けてください :)

よろしくミハル

4

3 に答える 3

0

[mapView setRegion:region animated:NO];で 削除- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)aUserLocation

于 2012-04-18T10:50:33.983 に答える
0
[mapView setRegion:region animated:NO]; //Changes the currently visible region and optionally animates the change.
于 2012-04-18T10:52:27.120 に答える