如何检测何时使用MKUserTrackingBarButtonItem [英] How to detect when MKUserTrackingBarButtonItem is used

查看:72
本文介绍了如何检测何时使用MKUserTrackingBarButtonItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试寻找一种方法来检测何时使用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).

ref: http://developer.apple.com/library/ios/documentation/MapKit/Reference/MKMapViewDelegate_Protocol/MKMapViewDelegate/MKMapViewDelegate.html#//apple_ref/occ/intfm/MKMapViewDelegate/mapView: didChangeUserTrackingMode:动画:

这篇关于如何检测何时使用MKUserTrackingBarButtonItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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