我有一个 MKPinAnnotationView 并且在我的 viewForAnnotation 方法中,我执行以下操作:
customPinView.image = [UIImage imageNamed:@"blah.png"];
我已将 blah.png 添加到我的资源中(通过将文件拖入)
但我仍然看到股票别针而不是我的形象。难道我做错了什么?这是完整的代码:
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation
{
static NSString *AnnotationViewID = @"annotationViewID";
MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];
if (annotationView == nil)
{
annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
}
annotationView.image = [UIImage imageNamed:@"blah.png"];
annotationView.annotation = annotation;
return annotationView;
}