2012-04-11 11 views
2

このコードを使用して注釈の色を変更しましたが、その後にタイトルとサブタイトルを表示できません。ピンチカラーを変更した後に注釈のタイトルを表示することはできません

コードは以下のとおりです。

- (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id <MKAnnotation>)annotation 
{ 
    static NSString *defaultPinID = @"LYB"; 
    MKPinAnnotationView *customPinview = (MKPinAnnotationView *)[_mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID]; 
    if (customPinview == nil) { 
     customPinview = [[[MKPinAnnotationView alloc] 
        initWithAnnotation:from reuseIdentifier:defaultPinID] autorelease]; 
    } 
    if ([annotation isKindOfClass:[MKUserLocation class]]) 
     return nil; 
    if ([[annotation title] isEqualToString:@"the first"]) { 
     customPinview.pinColor = MKPinAnnotationColorGreen; 
    } 
    return customPinview; 
} 

答えて

2

"customPinviewを返す" の前に新しい行に次のコードを追加します。

customPinview.canShowCallout = YES; 
関連する問題