MKAnnotationView不显示自定义引脚

时间:2013-04-15 23:01:21

标签: ios5 ios6 mapkit

我正在为地图实现自定义图钉,图片位于te项目的文件夹中但未显示。 也许(很可能)我做错了什么。

地图显示并显示引脚(默认红色引脚),但不显示自定义图像,也不显示UIButtonTypeDetailDisclosure

这是我正在使用的代码:

- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id<MKAnnotation>)annotation
{

// in case it's the user location, we already have an annotation, so just return nil
if ([annotation isKindOfClass:[MKUserLocation class]])
{
    return nil;
}
 static NSString *TheAnnotationIdentifier = @"theAnnotationIdentifier";

MKAnnotationView *shoppeAnnotationView =
[self.mapView dequeueReusableAnnotationViewWithIdentifier:TheAnnotationIdentifier];
if (shoppeAnnotationView == nil)
{
    MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:TheAnnotationIdentifier];

    annotationView.canShowCallout = YES;

    annotationView.image = [UIImage imageNamed:@"pin.png"];
    annotationView.rightCalloutAccessoryView = [ UIButton buttonWithType:UIButtonTypeDetailDisclosure ];
    annotationView.opaque = NO;

    return annotationView; 
}
    return nil;
}

任何提示?

谢谢!

0 个答案:

没有答案