2012-05-02 38 views

回答

2

是的。舉例來看看模擬器調試>位置>城市自行車騎行。它確實慢迴路一輪舊金山(?)

要收聽更新你的MapView委託

- (void)mapView:(MKMapView *)amapView didUpdateUserLocation:(MKUserLocation *)userLocation 
{ 
    NSLog(@"im here! - %f,%f",userLocation.location.coordinate.latitude,userLocation.location.coordinate.longitude); 


} 

實施和調整註釋實現

- (MKAnnotationView *) mapView:(MKMapView *)amapView viewForAnnotation:(id <MKAnnotation>) annotation{ 

    if ([annotation isKindOfClass:[MKUserLocation class]]) { 
     return nil; 
    } 
    NSLog(@"annotation = %@",((NSObject *)annotation)); 
    MKAnnotationView *annView; 

    annView = [amapView dequeueReusableAnnotationViewWithIdentifier:@"currentloc"]; 

    if(!annView) 
    { 
     annView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"] autorelease]; 
     ((MKPinAnnotationView *)annView).pinColor = MKPinAnnotationColorGreen; 
     ((MKPinAnnotationView *)annView).animatesDrop=TRUE; 
     annView.canShowCallout = YES; 
     annView.calloutOffset = CGPointMake(-5, 5); 
     annView.draggable = YES; 
    } 
    return annView; 
} 

我已經把該剪斷只需用默認的藍點和精確度圓即可,返回nil爲MKUserLocation,但您的實現可能會有所不同。