【问题标题】:Map custom annotation is not showing in device地图自定义注释未显示在设备中
【发布时间】:2014-06-25 11:13:36
【问题描述】:

我正在通过此代码更改我的 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 中进行测试时,那里没有显示任何内容。如果我删除图像,则默认图钉显示在两者中。设备注释中还有一件事,但它仅不可见。

【问题讨论】:

    标签: ios7 mkmapview mkannotation mkannotationview mkmapviewdelegate


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多