MapKit重置为用户当前位置

时间:2013-07-19 16:37:18

标签: ios objective-c ios6 mapkit

我对MapKit有一个奇怪的问题。 我有一个带有注释的地图视图,当用户点击该引脚时,我按下了一个引脚的详细视图控制器

-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
    if ([view.annotation isKindOfClass:[ImagePin class]])
    {
        if (!self.pinPhotoDetailViewController) {
            self.pinPhotoDetailViewController = [[PinPhotoDetailViewController alloc] initWithNibName:@"PinPhotoDetailViewController" bundle:nil];
        }
        self.pinPhotoDetailViewController.managedObjectContext = self.managedObjectContext;
        self.pinPhotoDetailViewController.photoID = view.annotation.title;
        [self.navigationController pushViewController:self.pinPhotoDetailViewController animated:YES];
    }
}

问题在于,当我弹回地图时,它已经更改了区域,现在显示了用户当前位置的区域。 我使用以下代码初始化地图视图:

- (void)viewDidLoad
{
    [super viewDidLoad];
    locationManager = [[CLLocationManager alloc] init];
    [locationManager setDelegate:self];
    [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
    self.mapView.userTrackingMode = MKUserTrackingModeNone;

    [self.mapView setShowsUserLocation:YES];

    [locationManager setDistanceFilter:80.0f];
    [locationManager setDesiredAccuracy:kCLLocationAccuracyBest];

    firstLaunch=YES;
    [self customizeStyle];

}

我在哪里做错了什么?

0 个答案:

没有答案