0
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation {
NSLog(@"I'm Working");
static NSString *identifier = @"MyLocation";
if ([annotation isKindOfClass:[userPins class]]) {
userPins *location = (userPins *) annotation;
MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [_mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
if (annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
} else {
annotationView.annotation = annotation;
}
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
if ([location.name compare:@"LARCENY"] == NSOrderedSame) {
annotationView.pinColor = MKPinAnnotationColorGreen;
}
return annotationView;
}
return nil;
}
이 코드는 작동하지 않습니다. JSON에서 핀을 추가하고 있습니다. 빨간색 핀이 보이지만 nslog가 보이지 않습니다 (작동 중입니다). 어떤 아이디어?MKAnnotationView do do nothing
게시물의 형식을 잘 지정하십시오. 중단 점 설정을 시도 했습니까? –
.h 파일에 MKMapViewDelegate 프로토콜 참조를 추가 했습니까? – tilo