【发布时间】: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