gpt4 book ai didi

swift - 为 GMSMarker 设置自定义 accessibilityIdentifier

转载 作者:搜寻专家 更新时间:2023-10-31 19:37:16 24 4
gpt4 key购买 nike

我将 Google Maps Api 用于 map 和标记。

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

现在我在 map 上的所有自定义标记都具有辅助功能 ID,例如:myappname.GMSPlaceMarker_somenumbers,例如 myappname.GMSPlaceMarker_0x600000170200

我如何为所有图钉设置一个accessibilityIdentifier,例如 map 图钉

我已经试过了:

  • marker.accessibilityLabel = "Map pin" 但它设置的是 label 值,而不是 id
  • marker.title = "Map pin" 没有变化
  • marker.setValue("Map pin", forKey: "accessibilityIdentifier") 没有任何变化

我的 markerlet marker = GMSPlaceMarker() where class 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)
}

关于swift - 为 GMSMarker 设置自定义 accessibilityIdentifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42060803/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com