ios谷歌地图显示不出来

Taxi or travel apps always need to show the direction of travel on the map. In this quick tutorial, I will show you how to set up, show, and test the directional marker on the maps.

出租车或旅行应用程序始终需要在地图上显示旅行方向。 在本快速教程中,我将向您展示如何在地图上设置,显示和测试方向标记。

Completed tutorial on Github here.

在此处完成有关Github的教程。

So, at first, we need these keys in info.plist file. These settings will allow us to use user location detection from our app.

因此,首先,我们需要在info.plist文件中使用这些键。 这些设置将使我们能够使用应用程序中的用户位置检测。

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key><string>Your location is required for taxi correct work</string><key>NSLocationAlwaysUsageDescription</key><string>Your location is required for taxi correct work</string><key>NSLocationWhenInUseUsageDescription</key><string>Your location is required for taxi correct work</string>

Second, we need to import the CoreLocation framework in our controller and create CLLocationManager. After that, we need to set up this manager like below.

其次,我们需要在控制器中导入CoreLocation框架并创建CLLocationManager 。 之后,我们需要像下面这样设置此经理。

As a location delegate, our ViewController needs to conform to CLLocationManagerDelegate.

作为位置委托,我们的ViewController需要符合CLLocationManagerDelegate

As we can see, here we have a point variable — it is the latitude and longitude of our device. Also, we have location.course property. This is a course of location in degrees to true North. The range of this property is 0.0 –359.9 degrees, 0 being true North. (It can return -1 if the device is motionless).

可以看到,这里有一个point变量-它是设备的经度和纬度。 此外,我们还有location.course属性。 这是相对于真实北向的定位路线。 此属性的范围是0.0 –359.9度,0是真北。 (如果设备静止不动,则返回-1)。

Right now our app receives device location and direction. And with this data, we can build a custom marker on any map for showing users direction.

现在,我们的应用会接收设备的位置和方向。 借助这些数据,我们可以在任何地图上构建自定义标记以显示用户方向。

测试中 (Testing)

it was unclear how to test it without real travel. But Apple did this for us, and Xcode has built-in travel simulation. You just need to run Simulator and choose Features -> Location -> Freeway Drive.

目前尚不清楚如何在没有实际旅行的情况下进行测试。 但是Apple为我们做到了这一点,Xcode具有内置的旅行模拟功能。 您只需要运行模拟器并选择功能->位置->高速公路驱动器。

Google Maps部分 (Google Maps Part)

Installation guide you can find here in the official documentation. You need to get Google API Key here. After that — you can set this key in the AppDelegate class. (Make sure to replace “YOUR_API_KEY” on your real Google API Key.

您可以在官方文档中找到安装指南。 您需要在此处获取Google API密钥。 之后,您可以在AppDelegate类中设置此键。 (请确保在真实的Google API密钥上替换“YOUR_API_KEY”

And as you can see, we just need to create our custom marker and turn it on angle provided by CoreLocation. But before that, we need to transform angle from degrees to radians. We don’t need to redraw marker, we just need to change the position of it. And that it.

正如您所看到的,我们只需要创建自定义标记并将其打开CoreLocation提供的角度即可。 但是在此之前,我们需要将角度从度转换为弧度。 我们不需要重绘标记,我们只需要更改其位置即可。 就是这样。

结果 (Result)

加入我! (Join Me!)

LinkedIn Twitter Original Blog Github

LinkedIn Twitter 原始博客 Github

翻译自: https://medium.com/flawless-app-stories/show-the-direction-of-travel-in-ios-google-maps-7398a7822552

ios谷歌地图显示不出来


http://www.taodudu.cc/news/show-5534538.html

相关文章:

  • Google Maps 地图显示白屏
  • 【python】TXT文本数据清洗和英文分词、词性标注
  • [STM32F1]基于STM32F103实现Xbox 360 Controller for Windows 之Xinput
  • 《口袋妖怪 太阳/月亮》正式公布 简体中文确认
  • 个体值0和31差多少攻击_最强进化3period;0普通版个体值作弊码 | 手游网游页游攻略大全...
  • 由于金手指氧化导致硬盘坏道,性能下降
  • 多媒体设计计算机音乐创作原创音乐,多媒体设计计算机音乐创作原创音乐[计算机辅助音乐创作教学,改善课堂教学效果].doc...
  • 让人瞩目的插画设计秘诀在哪?为你揭开3D辅助绘画技术面纱!
  • IPAD2 5.1.1越狱后的屏幕不能自动旋转~~~
  • Python量化交易实战-40easytrader开发环境安装
  • 上海亚商投顾:沪指震荡调整 酒店等消费股逆势活跃
  • 上海亚商投顾:沪指尾盘快速反弹微幅收跌 6G概念大涨
  • 上海亚商投顾:沪指震荡反弹涨1.2% 中国移动创历史新高
  • Easyrecovery home15密钥及安装修复硬盘数据教程
  • 驱动人生解决“检测到你的驱动版本比较低”的问题
  • 显卡驱动程序有必要更新吗?驱动人生带你分析
  • 驱动人生病毒vschost.exe的排查流程(1)
  • 驱动人生教你怎么正确快速安装电脑显卡驱动
  • linux基础理论知识篇大全(表格版)
  • ContentProvider详解及使用大全
  • Linux命令---常用命令大全
  • javascript基础知识大全
  • mysql笔记大全
  • Linux 命令 用法 大全(超详细)
  • Oracle学习大全
  • Promise 大全
  • js基本功能大全
  • 通达信接口大全知识分享
  • 通达信服务器系统日线,券商网络接口分析方法(已经可以与通达信服务器行情数据连接!)(页 1) - 股软开源综合交......
  • cnpm : 无法加载文件 C:\Users\Cici\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本

ios谷歌地图显示不出来_在iOS Google Maps中显示行进方向相关推荐

  1. 谷歌maps菜单语言设置_如何在Google Maps中测量跑步,骑自行车和徒步旅行的距离...

    谷歌maps菜单语言设置 Getting directions in Google Maps lets you easily see how far away the destination is. ...

  2. 如何在谷歌地图自定义范围_如何在Google表格中更改和创建自定义数字格式

    如何在谷歌地图自定义范围 Khamosh Pathak Khamosh Pathak By default, Google Sheets doesn't format numbers. If you' ...

  3. 谷歌书签删除重复_如何删除Google表格中的重复项

    谷歌书签删除重复 Google Sheets lets you remove duplicates from your document with three methods ranging from ...

  4. 如何在cad中导入谷歌地图_如何在Google地图中设置出发和到达时间

    如何在cad中导入谷歌地图 Unless you work from home, Google Maps is fantastic at knowing where you need to be, a ...

  5. ios开发 架子鼓功能开发_适用于iOS开发人员的功能标志

    ios开发 架子鼓功能开发 When building modern applications, things tend to move quite quickly. When you add mul ...

  6. 怎么在谷歌地图上画图_如何在Google地图上规划具有多个目的地的公路旅行

    怎么在谷歌地图上画图 Whether you're planning a day out on the town, or want to orchestrate the perfect road tr ...

  7. 谷歌日历一键删除日程_如何在Google日历中删除新的提醒

    谷歌日历一键删除日程 In December 2015, Google added reminders to the Google Calendar app for Android and iOS u ...

  8. 谷歌的愿景_什么是Google API愿景以及如何使用它

    谷歌的愿景 介绍 (Introduction) This post finds his root in an interesting project of knowledge extraction. ...

  9. 谷歌标签恢复_避免/从Google惩罚中恢复

    谷歌标签恢复 如何从Google Penalty中恢复? (How to Recover from Google Penalty ?) Many webmasters sometimes face a ...

最新文章

  1. java的高级特性_java的高级特性_for
  2. 基于级联FFT的广义互相关算法在声源定位中的应用
  3. 基于JSP实现人力资源管理系统
  4. 51nod 1270 数组的最大代价
  5. OpenGL缩放转换
  6. Some Experience about userControls
  7. 用户空间使用内核头文件
  8. c,c++中字符串处理函数strtok,strstr,strchr,strsub
  9. 小程序FMP优化实录,大厂面试题汇总
  10. Web应用中request获取各种获取path或URI,URL的方法
  11. [转]ASP.NET面试题
  12. 高分选手讲解:如何突破思维圈限,从NLP角度挖掘新的解题思路
  13. 蓝桥杯 历届试题 剪格子(dfs搜索)
  14. python3.5安装tensorflow_如何为Python 3.5安装OpenCV,Tensorflow和机器学习框架运行对象检测应用程序...
  15. 一起用Python做个车牌自动识别系统,好玩又实用!
  16. ubuntu20.04【一键脚本安装wps并配置字体】
  17. python label显示图片_Python3 tkinter基础 Label imag显示图片
  18. 如何使用文件保险箱加密 Mac 上的启动磁盘?
  19. [原创] Hzc:FZL中带点鼠绘的感觉(教程)
  20. stm32f103移植到stm32f105的时钟问题

热门文章

  1. 使用Appium抓取抖音粉丝信息
  2. datagrid技巧大全
  3. 要过年了,换个发微信红包新姿势
  4. MySQL基础入门看这篇就够了,java反射原理hash
  5. StringBuffer详解
  6. Android系统核心机制之APP启动的程序入口ActivityThread的简单介绍
  7. java里氏替换原则例子_java设计模式学习笔记——里氏替换原则
  8. 安踏的搜索引擎营销_安踏这波操作,可能是今年体育界最成功的营销
  9. LINUX 下 HYLAFAX IAX搭建发送传真
  10. 服装实体店如何突破销售困境