加载新视图时如何禁用UISwipeGestureRecognizer? [英] How to disable UISwipeGestureRecognizer when load a new view?

查看:64
本文介绍了加载新视图时如何禁用UISwipeGestureRecognizer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我设置的viewDidLoad中

in my viewDidLoad I set

UISwipeGestureRecognizer *swipeRecognizerU = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeUpDetected:)]; swipeRecognizerU.direction = UISwipeGestureRecognizerDirectionUp; [self.view addGestureRecognizer:swipeRecognizerU];

当我通过弹出窗口加载新视图时,我需要禁用该手势

when I load a new view through popup I need to disable that gesture

// show popup view
-(IBAction)showPopup:(id)sender
{
    MJDetailViewController *detailViewController = [[MJDetailViewController alloc] initWithNibName:@"MJDetailViewController" bundle:nil];
    [self presentPopupViewController:detailViewController animationType:MJPopupViewAnimationSlideBottomBottom];
}

关闭弹出视图后,我需要重新设置滑动手势.

after popup view is dismissed, I need to set swipe gesture back.

// hide popup view
-(IBAction)hidePopup:(id)sender
{
    [self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationSlideBottomBottom];
}

这怎么办?

推荐答案

我认为有一个为UIGestureRecognizer启用的属性.您是否尝试过此操作,应该可以禁用滑动:

I think there is property named enabled for UIGestureRecognizer. Have you try this, it should be ok to disable your swipes:

swipeGestureRecognizer.enabled = NO;

这篇关于加载新视图时如何禁用UISwipeGestureRecognizer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆