2017-07-08 7 views
0

ユーザー位置の注釈イメージを変更するように見えることがあります。 私が間違っていますどこにそれがデキューすることはできません最初に注釈を初期化するのを忘れユーザー位置ピンのカスタム注釈

-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { 
    if ([annotation isKindOfClass:[MKUserLocation class]]) { 
     NSString* AnnotationIdentifier = @"Annotation"; 
     MKAnnotationView *annoationView = [mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier]; 
     [annoationView setImage:[UIImage imageNamed:@"melocation"] ]; 
     return annoationView; 
    } 
} 

答えて

1

...あれば多分誰かが見ることができる:

-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { 
    if ([annotation isKindOfClass:[MKUserLocation class]]) { 
     static NSString* const kAnnotationIdentifier = @"Annotation"; 
     MKAnnotationView *annoationView = [mapView dequeueReusableAnnotationViewWithIdentifier:kAnnotationIdentifier]; 
     if (!annoationView) { 
      annoationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:kAnnotationIdentifier]; 
     } 
     [annoationView setImage:[UIImage imageNamed:@"melocation"] ]; 
     return annoationView; 
    } 
    return nil; 
} 
+0

いやぁ... あなたが言ったように私はそれを忘れました。 ありがとう! – ironRoei

関連する問題