XCode/iOS: Storyboard Segue event does not work after adding UIGestureRecognizerDelegate to UIViewController

StackOverflow https://stackoverflow.com/questions/9401258

문제

I have simple Storyboard with two Scenes (SceneA and SceneB) and two custom UIViewController implementation. SceneA has a button with a segue (modal) over to SceneB. It works just fine this far: app starts with SceneA and pressing the button flips over to SceneB.

In the next step I add to the ViewController implementation, because I would like to detect specific gestures (click/swipe/etc) on SceneA in the custom UIViewController implementation. This is where things go wrong.

In the test the gestures are detected and the UI responds accordingly, however the segue does not work anymore. I suspect the gesture recognizer "swallows" the event that would trigger the segue, but I am not sure how to resolve. Is there a simple way to delegate or bubble-up the events to the Storyboard?

(I suppose the alternative would be to detect the tap event and programmatically do the segue, but I would prefer some form of delegation if possible.)

[XCode 4.2.1 | iOS SDK 5.0 | iPhone 5.0 Simulator]

도움이 되었습니까?

해결책

When you create your gesture recognizer, set the cancelsTouchesInView property to NO. By default, this is set to YES.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top