0

我正在通过以下代码更改我的 pin 注释视图:

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

    if([annotation isKindOfClass:[MKUserLocation class]])
        return nil;
    static NSString *identifier=@"myAnnotation";

    MapObjects *annotation1=(MapObjects*)annotation;
    MKPinAnnotationView * annotationView = (MKPinAnnotationView*)[self.map_whereAreVehicles dequeueReusableAnnotationViewWithIdentifier:identifier];
    if(!annotationView){
        annotationView= [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:nil];
        annotationView.image=[UIImage imageNamed:@"greenpin.png"];
        annotationView.animatesDrop = NO;

        annotationView.canShowCallout = NO;
    }
    else{
        annotationView.annotation=annotation;
    }
    return annotationView;
}

这向我展示了模拟器中的图像。但是当我在 ipad 中进行测试时,那里没有显示任何内容。如果我删除图像,则默认引脚显示在两者中。设备注释中还有一件事,但它仅不可见。

4

1 回答 1

1

也许问题是您的文件名。模拟器不区分大小写,设备不区分大小写。请确保您使用正确的文件名。

于 2014-06-25T11:34:57.770 回答