2010-05-19 5 views
1

사용자의 현재 위치 외에도 내지도에 많은 주석이 있습니다. 사용자의 현재 위치에 대한 기본 색상이 다른 모든 특수 효과와 동일하다는 점을 제외하고는 정상적으로 작동합니다. 사용자의 현재 위치에 대해 핀을 녹색으로 지정하여 다른 핀에서 고유하게 식별 할 수 있도록하고 싶습니다. 어떻게해야합니까? 당신이 당신을 사용자 위치 표준 MKUserLocation 유형을 사용하는 경우iPhone지도 : 사용자 위치를 다른 핀과 구별

- (MKAnnotationView *)mapView:(MKMapView *)mapViewLocal viewForAnnotation:(id <MKAnnotation>)annotation { 
    static NSString *identifier = @"Pin"; 
    MKPinAnnotationView *pinView = (MKPinAnnotationView*)[mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; 

    if (pinView == nil) 
    { 
     pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier] autorelease]; 
     pinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 
     pinView.animatesDrop = YES; 
     pinView.canShowCallout = YES; 
    } 
    else 
    { 
     pinView.annotation = annotation; 
    } 

    return pinView; 
}

답변

3

:

우는 소리는 내가 사용했던 방법 (I은 주석 확인할 수있는 방법을 찾을 수있는 사용자의 현재 위치)입니다 주석 유형이 동일하면 확인할 수 있습니다.

... 
if ([annotation isKindOfClass:[MKUserLocation class]]){ 
// This is annotation for user location 
}