2015-05-23 71 views
0

我在UINavigationController中有一個UIScrollView,但我發現在觸摸scrollView時我無法使用系統的彈出手勢,應該如何解決衝突?如何在UIScrollView中使用系統彈出手勢?

+0

更具體,你想要點擊滾動視圖時彈出? – Wingzero

+0

@Wingzero,不,一般來說,當我從屏幕的左邊緣平移時,它會觸發彈出式動作,但如果我將scrollView添加到屏幕邊緣,則不起作用。 – Rick

+0

好吧,你需要檢查哪個手勢識別器失敗了,你應該提供更多的細節,如果你想讓人們幫助你。 UIScrollView有一些用於縮放和滾動的手勢,您可以從這裏開始瞭解哪些識別器被識別,以及失敗。 – Wingzero

回答

1

固定,自定義左側導航項目導致此問題,我添加代碼

if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { 
      self.navigationController.interactivePopGestureRecognizer.delegate = nil; 
     } 

,但仍然在某些情況下無法正常工作,應該修改像

if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { 
      self.navigationController.interactivePopGestureRecognizer.delegate = self; 
     } 
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 
{ 
    return YES; 
} 

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 
{ 
    return [gestureRecognizer isKindOfClass:UIScreenEdgePanGestureRecognizer.class]; 
} 
相關問題