【问题标题】:Is there any default button for mapKit to allow user to change the orientation of the map from device heading to North up?mapKit 是否有任何默认按钮允许用户将地图的方向从设备方向更改为北上?
【发布时间】:2021-06-22 04:53:46
【问题描述】:

我正在使用 mapKit,并且想要几个按钮。

一种是将方向或地图从北向上更改为设备航向。另一种是以用户位置为中心,最后在卫星地图和混合地图之间切换。

这可以在带有信息和方向按钮的地图应用程序上使用,我可以使用我自己的自定义实现来实现这一点。但在这样做之前,我想知道 mapKit 是否已经内置了这个功能?

是否有任何选项可以在不自己实现按钮和逻辑的情况下将上述功能添加到 mapView?

【问题讨论】:

    标签: ios swift xcode swiftui mapkit


    【解决方案1】:

    是的,有一个名为MKUserTrackingButton 的按钮。 (You can read more about it here)

    要实现它,您应该设置userTrackingMode 属性。 (See more)

    它在 iOS11.0+ 上可用,所以它应该可以完成这项工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 2020-01-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多