簡體   English   中英

iOS暫時禁用頁面視圖控制器刷卡

[英]iOS temporarily disable Page View Controller swiping

我有一個設置,其中有一個Page View Controller ,可以在不同的views之間導航。

在這些視圖中的某些視圖中,我將具有一個custom drawing view ,用戶可以在其中用手指繪圖以創建圖片。

與此相關的問題是,由於page view controller將接管並導航到其他視圖,因此用戶無法left/right做出繪畫手勢。

我想知道暫時禁用page view controllerswiping以允許用戶draw的好方法是什么。

我在想,當用戶第一次與工程drawing view交互時,它將禁用page swiping並創建finished drawing button 單擊此按鈕后,將重新啟用page swiping 這看起來合理嗎,還是有人知道更好的方法嗎?

使用這個可以停止滾動

for (UIScrollView *view in self.pageViewController.view.subviews) {

if ([view isKindOfClass:[UIScrollView class]]) {

    view.scrollEnabled = NO;
}
}

我將研究以下UIGestureRecognizerDelegate方法:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;

在這里,您可以通過禁用並重新啟用它來“殺死”頁面視圖控制器的手勢識別器:

if (/* otherGestureRecognizer is page view controller's */) {
    otherGestureRecognizer.enabled = NO;
    otherGestureRecognizer.enabled = YES;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM