gpt4 book ai didi

swift - didUpdateLocation 什么时候被调用?

转载 作者:行者123 更新时间:2023-11-28 16:05:49 26 4
gpt4 key购买 nike

假设您想将 MapView 聚焦在当前位置,然后在 didUpdateLocation 中编写一些代码来处理当前位置坐标。

但是,如果您不在 CLLocationManager 对象上调用 requestLocationstartUpdatingLocaion,则永远不会调用该方法。对吗?

但是无论您是调用 requestLocation 还是 startUpdatingLocation,如果您在 MapView 上查看显示您的位置移动的蓝点(例如,您模拟移动) 但不会自动调用 didUpdateLocation。

我试图理解为什么当您必须自己调用委托(delegate)方法时,他们却创建了委托(delegate)方法。

最佳答案

您必须调用 startUpdatingLocation 一次,并且每次位置更改时都会调用 didUpdateLocation 委托(delegate)方法。这与您所说的有很大不同。

关于swift - didUpdateLocation 什么时候被调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40313838/

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