加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift – 为GMSMarker设置自定义accessibilityIdentifier

发布时间:2020-12-14 04:31:44 所属栏目:百科 来源:网络整理
导读:我使用Google Maps Api来制作地图和标记. 我通过设置:mapView.accessibilityElementsHidden = false来启用标记的可访问性 现在,我在地图上的所有自定义标记都具有可访问性ID,例如:myappname.GMSPlaceMarker_somenumbers,例如myappname.GMSPlaceMarker_0x60
我使用Google Maps Api来制作地图和标记.

我通过设置:mapView.accessibilityElementsHidden = false来启用标记的可访问性

现在,我在地图上的所有自定义标记都具有可访问性ID,例如:myappname.GMSPlaceMarker_somenumbers,例如myappname.GMSPlaceMarker_0x600000170200.

我怎样才能为所有引脚设置一个accessibilityIdentifier,例如Map pin?

我已经尝试过:

> marker.accessibilityLabel =“Map pin”但它设置标签值,而不是id
> marker.title =“地图引脚”没有任何变化
> marker.setValue(“Map pin”,forKey:“accessibilityIdentifier”)没有任何变化

我的标记是让mark = GMSPlaceMarker(),其中GMSPlaceMarker类:??GMSMarker

解决方法

试试这个,

func markPoints() {
    var annotationCoord : CLLocationCoordinate2D = CLLocationCoordinate2D()
    annotationCoord.latitude = (selectedLocation.latitude as NSString).doubleValue
    annotationCoord.longitude = (selectedLocation.longitude as NSString).doubleValue

    let annotationPoint: MKPointAnnotation = MKPointAnnotation()
    annotationPoint.coordinate = annotationCoord
    annotationPoint.title = selectedLocation.name
    annotationPoint.subtitle = "Anand: 7348858742"
    theMap.addAnnotation(annotationPoint)
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读