我用这段代码改变了注解的颜色,但是之后标题和副标题就显示不出来了,我该如何解决这个问题?
代码是:
- (MKAnnotationView *)mapViewMKMapView *)mV viewForAnnotationid <MKAnnotation>)annotation
{
static NSString *defaultPinID = @"LYB";
MKPinAnnotationView *customPinview = (MKPinAnnotationView *)[_mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( customPinview == nil ) {
customPinview = [[[MKPinAnnotationView alloc]
initWithAnnotation:from reuseIdentifier:defaultPinID] autorelease];
}
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
if ([[annotation title] isEqualToString"the first"]) {
customPinview.pinColor = MKPinAnnotationColorGreen;
}
return customPinview;
}
Best Answer-推荐答案 strong>
在“return customPinview”之前的新行中添加以下代码:
customPinview.canShowCallout = YES;
关于ios - 更改pincolor后无法显示注释标题,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/10104164/
|