将方向箭头添加到Mapbox(iOS)上的当前位置 [英] Adding direction arrow to current location on Mapbox (iOS)

查看:233
本文介绍了将方向箭头添加到Mapbox(iOS)上的当前位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Mapbox来显示具有用户位置的地图的应用,它看起来像这样:

I have an app that uses Mapbox to present a map with the user location, it looks like this:

我想在当前位置标记上添加一个方向箭头,以向您显示行进的方向,就像这样:

I want to add a direction arrow to the current location marker that shows you the direction you're walking to, like that:

有人知道如何使用Mapbox iOS SDK添加此箭头吗?

Does anybody know how can I add this arrow using Mapbox iOS SDK?

谢谢!

推荐答案

使用适用于iOS v3.6.3或更高版本的Mapbox Maps SDK,可以使用

With Mapbox Maps SDK for iOS v3.6.3 or newer it’s possible to add an always-on heading indicator using MGLMapView.showsUserHeadingIndicator. With this setting enabled, the user location annotation will look like this:

另请参见此示例,以了解如何实现 custom 用户位置注释中的内容.

Also see this example for how to implement this in a custom user location annotation.

下面是后代的旧答案.

自定义用户位置注释视图是即将发布的v3.4.0版本的功能,您现在可以在

Custom user location annotation views are a feature of the upcoming v3.4.0 release, which you can try out now in pre-release.

您可能会找到SDK的默认实现

You may find the SDK’s default implementation of MGLUserLocationAnnotationView, MGLFaux3DUserLocationAnnotationView, useful in constructing your own.

关于添加始终在线的标题指示符,这是尚不可能的MGLMapView的位置管理器配合使用-目前,如果跟踪模式不是.FollowWithHeading,则需要从您自己的位置管理器获取标题.

As for adding an always-on heading indicator, that’s not yet possible with MGLMapView’s location manager — for now, you will need to get the heading from your own location manager when the tracking mode is not .FollowWithHeading.

这篇关于将方向箭头添加到Mapbox(iOS)上的当前位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆