将UITapGestureRecognizer添加到与AnnotationView选择分开的MKMapView

时间:2014-02-23 20:57:26

标签: objective-c mkmapview mkannotation uitapgesturerecognizer

我正在使用CalloutBubbles创建一个带有MKMapView的{​​{1}},依此类推。 现在我想添加一个AnnotationView以全屏模式显示mapview,就像它在Apple的Maps App中做得好。我仍然创建了隐藏NavigationBarItems等的代码并且它运行良好但我的问题是仍然使用点击手势来选择注释。所以每次我想要触摸PinView,制作一个doubleTap等等我的代码被执行并且mapview进入全屏而不是打开calloutBubble,zoom等。

这是我的问题。是否有可能将UITapGestureRecognizer背景中的分接头与引脚上的分接头分开?

修改

当我使用MKMapView函数并在我的mapview的注释引脚上点击一下时,我会记录下这个描述:

  

2014-02-24 15:27:31.257 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,   目标=)>>

     

2014-02-24 15:27:31.257 MyApplication [807:70b]   < _MKUserInteractionGestureRecognizer:0xc80c470; baseClass =   UIGestureRecognizer; state =开始; cancelsTouchesInView = NO;   delaysTouchesEnded = NO; view =;目标=   <(action = handleTouch:,target =)>>

     

2014-02-24 15:27:31.258 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,   目标=)>>

     

2014-02-24 15:27:31.258 MyApplication [807:70b]   < _MKUserInteractionGestureRecognizer:0xc80c470; baseClass =   UIGestureRecognizer; state =开始; cancelsTouchesInView = NO;   delaysTouchesEnded = NO; view =;目标=   <(action = handleTouch:,target =)>>

     

2014-02-24 15:27:31.376 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.376 MyApplication [807:70b]   ; target =<(action = handleLongPress:,   目标=)>>

     

2014-02-24 15:27:31.377 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.377 MyApplication [807:70b]   < _MKUserInteractionGestureRecognizer:0xc80c470; baseClass =   UIGestureRecognizer; state =结束; cancelsTouchesInView = NO;   delaysTouchesEnded = NO; view =;目标=   <(action = handleTouch:,target =)>>

     

2014-02-24 15:27:31.377 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.377 MyApplication [807:70b]   ; target =<(action = handleTap:,target =)&gt ;; must-fail = {           ;   target =<(action = handleDoubleTap:,target =)&gt ;; numberOfTapsRequired = 2>,           ; target =<(action = handlePan:,   目标=)>>       }>

     

2014-02-24 15:27:31.378 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.378 MyApplication [807:70b]   ; target =<(action = handleTwoFingerTap:,   目标=)取代; numberOfTouchesRequired =   2 - ;

     

2014-02-24 15:27:31.378 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.379 MyApplication [807:70b]   ; target =<(action = handleTwoFingerLongPress:,   目标=)>>

     

2014-02-24 15:27:31.379 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.380 MyApplication [807:70b]   ; target =<(action = handlePinch:,   目标=)>>

     

2014-02-24 15:27:31.380 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.380 MyApplication [807:70b]   ; target =<(action = handlePan:,   目标=)取代; must-fail-for = {           ;目标=   <(action = handleTap:,target =)>>       }>

     

2014-02-24 15:27:31.380 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.381 MyApplication [807:70b]   ; target =<(action = handleRotation:,   目标=)>>

     

2014-02-24 15:27:31.381 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.381 MyApplication [807:70b]   ;   target =<(action = handleTilt:,target =)>>

     

2014-02-24 15:27:31.381 MyApplication [807:70b]   ; target =<(action = MySetFullScreenMap ,target =)>>

     

2014-02-24 15:27:31.382 MyApplication [807:70b]   ;目标=   <(action = handleLongPress:,target =)>>

在每种情况下,上面的日志是" gestureRecognizer"而较低的一个是" otherGestureRecognizer"。

我刚刚添加了一个UILongPressGestureRecognizer和UITapGestureRecognizer(用于我的功能" MySetFullScreenMap"

1 个答案:

答案 0 :(得分:0)

UIGestureRecognizer类具有附加到的视图的属性。这可以帮助您确定已点击的内容吗?