我希望正常的UINavigationController滑动背靠背手势工作在一个视图控制器,基本上是一个UIWebView浏览器。默认情况下,UIWebView似乎不允许UINavigationController回扫手势被识别。
如果我将UIWebView.delegate设置为视图控制器,并添加以下方法,它将正确识别UINavigationController's回扫。
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}但是在完成这个手势(这会弹出UIWebView's视图控制器)之后,当我做另一个手势时,它会崩溃。(下面是堆栈跟踪)而“其他手势”,我的意思是简单地滚动一个UIWebView在我弹出的视图控制器后的滑动。
是否总是YES返回值会扰乱UIWebView手势的正常交互?似乎我只想让导航手势始终是是的,但是我想让webview手势做他们通常做的任何事情,但是我不能仅仅调用[super gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]来获得这种行为。坦率地说,我感到惊讶的是,UIWebView代表竟然收到了手势回调。
Thread 1, Queue : com.apple.main-thread
#0 0x3a80cb66 in objc_msgSend ()
#1 0x32e23f9a in -[UIGestureRecognizer _delegateCanPreventGestureRecognizer:] ()
#2 0x32cce418 in -[UIGestureRecognizer _isExcludedByGesture:] ()
#3 0x32c9410e in _UIGestureRecognizerUpdate ()
#4 0x32ccd1b4 in -[UIWindow _sendGesturesForEvent:] ()
#5 0x32cccb62 in -[UIWindow sendEvent:] ()
#6 0x32ca1f58 in -[UIApplication sendEvent:] ()
#7 0x32ca0746 in _UIApplicationHandleEventQueue ()
#8 0x304e2f26 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#9 0x304e23ee in __CFRunLoopDoSources0 ()
#10 0x304e0bde in __CFRunLoopRun ()
#11 0x3044b540 in CFRunLoopRunSpecific ()
#12 0x3044b322 in CFRunLoopRunInMode ()
#13 0x351822ea in GSEventRunModal ()
#14 0x32d021e4 in UIApplicationMain ()
#15 0x000df478 in main at /path/to/main.m:17
#16 0x000df398 in start ()发布于 2014-04-22 19:21:43
我只是面临着同样的问题(但是我有一个常规的UIViewController -- MWPhotoBrowser --由于某些原因也阻止了这个系统的后退),我通过设置
self.navigationController.interactivePopGestureRecognizer.delegate = nil;在viewWillDisappear:处理器中。希望能帮上忙。
https://stackoverflow.com/questions/21366185
复制相似问题