简体   繁体   English

iOS暂时禁用页面视图控制器刷卡

[英]iOS temporarily disable Page View Controller swiping

I have a setup where I have a Page View Controller set up to navigate between different views . 我有一个设置,其中有一个Page View Controller ,可以在不同的views之间导航。

In some of these views I will have a custom drawing view where the user can draw with their finger to create a picture. 在这些视图中的某些视图中,我将具有一个custom drawing view ,用户可以在其中用手指绘图以创建图片。

The problem with this, the user is not able to make a drawing gesture left/right because the page view controller will take over and navigate to a different view. 与此相关的问题是,由于page view controller将接管并导航到其他视图,因此用户无法left/right做出绘画手势。

I was wondering what a good approach would be to temporarily disable the swiping for the page view controller to allow the user to draw . 我想知道暂时禁用page view controllerswiping以允许用户draw的好方法是什么。

I was thinking when the user first interacts with the drawing view it would disable the page swiping and create a finished drawing button . 我在想,当用户第一次与工程drawing view交互时,它将禁用page swiping并创建finished drawing button When this button is clicked it would reenable the page swiping . 单击此按钮后,将重新启用page swiping Does this seem reasonable, or does anybody know of any better approaches? 这看起来合理吗,还是有人知道更好的方法吗?

Using this you can stop Scrolling 使用这个可以停止滚动

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

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

    view.scrollEnabled = NO;
}
}

I'd look into this UIGestureRecognizerDelegate method: 我将研究以下UIGestureRecognizerDelegate方法:

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

Here you can "kill" the page view controller's gesture recognizer by disabling and re-enabling it: 在这里,您可以通过禁用并重新启用它来“杀死”页面视图控制器的手势识别器:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 暂时禁用手势识别器滑动功能 - Temporarily disable gesture recognizer swiping functionality 如何在基于页面的应用程序中的视图中禁用页面滑动 - how to disable swiping of pages in a view in page based application 当通过向下滑动关闭 iOS 中的查看 controller 时如何运行代码? - How to run code when view controller in iOS is dismissed by swiping down? iOS-在View Controller中禁用View缓存 - IOS - Disable View Cache in View Controller iOS Swift页面视图控制器 - iOS Swift Page View Controller 滑动页面视图控制器时,段控制器的选定段应更改 - Selected segment of a segment controller should change when swiping a page view controller 使用页面视图 Controller 在视图之间滑动时防止视图控制器更新 - Prevent view controllers from updating when swiping between views with a Page View Controller 禁用和重新启用Page View Controller手势识别器? - Disable and Reenable Page View Controller gesture recogniser? 如何在页面视图中禁用用户滑动,但仍启用与页面视图中子视图的交互。 前按钮 - How to disable user swiping in page view but still enable interaction with the subviews in the page view. e.x. button 在同一视图控制器内的图像之间滑动 - swiping between images within the same view controller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM