首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MapView注解

MapView注解
EN

Stack Overflow用户
提问于 2011-03-22 15:58:29
回答 1查看 703关注 0票数 0

我在注释视图上添加了一个图像,当我触摸注释视图时,它的图像变成了红色大头针,谁能告诉我这是什么原因

代码语言:javascript
复制
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation 
{
    MKPinAnnotationView* newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"annotation1"];

    if (annotation == _mapView.userLocation)
    {
        newAnnotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        return nil;
    }

    //[newAnnotation setSelected:YES];
    newAnnotation.image = [UIImage imageNamed:@"sample.png"];
    newAnnotation.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
    newAnnotation.canShowCallout = YES;
    [newAnnotation retain];

    return newAnnotation;

}
EN

回答 1

Stack Overflow用户

发布于 2011-03-22 17:34:43

使newAnnotation成为MKAnnotationView而不是MKPinAnnotationView

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5388288

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档