如何检测何时使用MKUserTrackingBarButtonItem [英] How to detect when MKUserTrackingBarButtonItem is used
问题描述
我目前正在尝试寻找一种方法来检测何时使用MKUserTrackingBarButtonItem
,而不是处理mapView:didUpdateUserLocation:
委托方法.
I'm currently trying to find a way to detect when the MKUserTrackingBarButtonItem
is used, other than deal with the mapView:didUpdateUserLocation:
delegate method.
我试图设置MKUserTrackingBarButtonItem
的setAction来调用我的函数(请选中
I tried to setAction of the MKUserTrackingBarButtonItem
to call my function (check this thread), but of curse it removes the updating location action, which I don't want.
我没有找到任何触发的委托方法:/
I don't find any delegate method triggered :/
感谢任何想法.
推荐答案
如果您的MKUserTrackingBarButtonItem
被分配了MKMapView
进行操作,则在更改跟踪模式时,地图视图的委托将收到mapView:didChangeUserTrackingMode:animated:
(可以通过按下该按钮来完成).
If your MKUserTrackingBarButtonItem
has been assigned a MKMapView
to operate on then the map view's delegate will receive mapView:didChangeUserTrackingMode:animated:
when the tracking mode is changed (which is done by pressing that button).
这篇关于如何检测何时使用MKUserTrackingBarButtonItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!