iOS背景MKPointAnnotation

时间:2014-09-02 14:20:40

标签: ios map annotations

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

所有它都在工作,但是,视图的MKPoiintAnnotation的“背景”是“不可见的”,所以它不是非常“可见”。

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

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

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

编辑:我想说的是“背景”,文字“当前位置”下的背景(对于这个例子):

enter image description here

编辑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];

2 个答案:

答案 0 :(得分:1)

您需要构建自定义注释,您可能希望遵循本教程:

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

答案 1 :(得分:0)

如果你的MapView在UITableView中,那么你需要将selectionStyle设置为UITableViewCellSelectionStyle.None。

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

override func awakeFromNib() {
    super.awakeFromNib()

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