2
을 표시하지 않습니다MKAnnotionView 내가 MKAnnotionView이 실현하는 것이를 만든 콜 아웃
- (MKAnnotationView*) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
if([annotation isKindOfClass:[MKUserLocation class]])
return nil;
NSString *identifier = @"mypin";
MKAnnotationView *annotationView = [mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
if(annotationView == nil)
{
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
annotationView.canShowCallout = YES;
UIImageView *pin = [[UIImageView alloc] initWithImage:[UIImage imageNamed:identifier]];
UIImageView *shadow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pin_shadow"]];
shadow.frame = CGRectMake(21, 36, 60, 27);
[annotationView addSubview:shadow];
[annotationView addSubview:pin];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(0, 0, 11, 20);
[btn setImage:[UIImage imageNamed:@"arrow"] forState:UIControlStateNormal];
annotationView.rightCalloutAccessoryView = btn;
annotationView.centerOffset = CGPointMake(-(44.0f/2), -62.0f);
}
return annotationView;
}
핀과 그림자가지도에 잘 표시하지만 난 핀을 누를 때 선이 이제 표시됩니다. 주석 객체에는 제목과 부제 값이 있다는 것이 긍정적입니다.
MKAnnotionView에서 .image 속성을 사용하여 핀을 추가하면 작동하지만 내 그림자는 핀 위에 있습니다. mehh! :/
무엇이 잘못 되었나요?