【问题标题】:iOS Background MKPointAnnotationiOS 后台 MKPointAnnotation
【发布时间】:2014-09-02 14:20:39
【问题描述】:

我的地图视图中很少有 MKPointAnnotation。

一切正常,但是视图的 MKPoiintAnnotation 的“背景”是“不可见的”,因此它不是很“可见”。

我想将背景更改为白色,我尝试使用:

  • (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation

但是我没有成功用这个方法改变背景。我需要使用什么?谢谢,

编辑:“背景”是指文本“当前位置”下的背景(对于本例):

编辑 2:

我正在使用此代码添加注释:

                annotationPoint = [[MKPointAnnotation alloc] init];
            annotationCoord.latitude = [[item getPlace] getLatitude];
            annotationCoord.longitude = [[item getPlace] getLongitude];
            annotationPoint.coordinate = annotationCoord;
            annotationPoint.title = item.getNom;
            annotationPoint.subtitle = [Utils getDateString :item.getDeadline :@"dd/MM/yyyy HH:mm"];
            [_mapView addAnnotation:annotationPoint];

【问题讨论】:

  • “背景”是什么意思?
  • 等等,我拿个屏幕:)
  • 你能把整个代码贴出来吗?
  • 但我不认为这是我的代码中的错误,因为“当前位置”不是由我创建的。应该有一个选项来改变这个......
  • 您可以在iOS Simulator>Debug>Location下设置GPS坐标。你知道吗?您的代码看起来不错,应该可以正常工作

标签: ios map annotations


【解决方案1】:

您需要构建一个自定义注解,您可能需要按照本教程进行操作:

http://blog.asynchrony.com/2010/09/building-custom-map-annotation-callouts-part-2/

【讨论】:

  • 你的其他注释是否也有同样的问题?
  • 哼,这不是我的问题:/
【解决方案2】:

如果您的 MapView 在 UITableView 中,则需要将 selectionStyle 设置为 UITableViewCellSelectionStyle.None。

例如在 Swift 中,我在自定义表格单元格类的 awakeFromNib 函数中添加了以下内容:

override func awakeFromNib() {
    super.awakeFromNib()

    // Selection style for the cell
    self.selectionStyle = UITableViewCellSelectionStyle.None
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-18
    • 1970-01-01
    • 1970-01-01
    • 2012-09-14
    • 2017-10-01
    • 2013-03-24
    • 1970-01-01
    相关资源
    最近更新 更多