微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

swift – 为GMSMarker设置自定义accessibilityIdentifier

我使用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)
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐