Я сделал это РЕАЛИЗАЦИЯ из 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;
}
Штифты и тени появляются отлично на карте, но когда я нажимаю булавку выноска теперь показывается. Я уверен, что объекты аннотации имеют заголовок и значение субтитров.
Если я добавлю свой вывод, используя свойство .image на MKAnnotionView, он работает, но тогда моя тень находится поверх булавки .. mehh! :/
Что происходит не так?