【发布时间】:2011-11-23 05:03:34
【问题描述】:
我在 ViewController 中有一个 MKMapView,我想在用户使用这些方法触摸地图时检测用户的手势:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
该应用在 iOS 3、iOS 4 上运行良好 但是当我使用在 iOS 5 上运行的 iPhone 调试应用程序时,我看到了这条消息:
Pre-iOS 5.0 touch delivery method forwarding relied upon. Forwarding -touchesCancelled:withEvent: to <MKAnnotationContainerView: 0x634790; frame = (0 0; 262144 262144); autoresizesSubviews = NO; layer = <CALayer: 0x634710>>
以上4个方法中的代码都没有到达。
你知道怎么解决吗?
谢谢。
【问题讨论】:
-
尚不能评论 iOS 5 但对于 3.2 到 4,使用 UIGestureRecognizer 代替 touches 方法可能更容易。
标签: iphone objective-c ios mkmapview touch-event