为 GMSMarker 设置自定义辅助功能标识符

QAu*_*ron 5 google-maps-sdk-ios swift

我使用 Google Maps Api 制作地图和标记。

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

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

例如,我如何accessibilityIdentifier为所有引脚设置一个Map pin

我已经尝试过:

  • marker.accessibilityLabel = "Map pin"但它设定了label价值,而不是id
  • marker.title = "Map pin" 没有什么改变
  • marker.setValue("Map pin", forKey: "accessibilityIdentifier") 没有什么改变

markerlet marker = GMSPlaceMarker()在哪里class GMSPlaceMarker: GMSMarker

小智 0

尝试这个,

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)
}
Run Code Online (Sandbox Code Playgroud)