3

viewDidLoad方法中,我将 userTrackingMode 设置为MKUserTrackingModeFollowWithHeading. 在向 mapview 添加一些注释和覆盖后,mapview 委托方法mapView:didChangeUserTrackingMode:animated:被触发。然后 mapview userTrackingMode 回到MKUserTrackingModeFollow. 为什么?

这是代码:

.......
    [self.pMapView addOverlay: self.pPolyline];
.......
    [self.pMapView setRegion:region animated:YES];

我确实删除了一些注释,但我没有删除 userLocation。

- (void) removeAllAnnotationsExceptUserLocationAndDestinAnnotation
{
    for (id<MKAnnotation> annotation in [[self.pMapView.annotations copy] autorelease])
    {
        if ([annotation isMemberOfClass: [MKUserLocation class]]) continue;

        CLLocationDegrees anLat = [self latitudeOfDestination];
        CLLocationDegrees anLon = [self longitudeOfDestination];

        if (anLat == annotation.coordinate.latitude && anLon == annotation.coordinate.longitude)
        {
            continue;
        }

        [self.pMapView removeAnnotation: annotation];
    }
}
4

0 回答 0