gpt4 book ai didi

ios - 加载新 View 时如何禁用 UISwipeGestureRecognizer?

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:09:29 26 4
gpt4 key购买 nike

在我设置的 viewDidLoad 中

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

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

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

弹出 View 关闭后,我需要重新设置滑动手势。

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

如何做到这一点?

最佳答案

我认为 UIGestureRecognizer 有一个名为 enabled 的属性。你试过这个吗,禁用你的滑动应该没问题:

swipeGestureRecognizer.enabled = NO;

关于ios - 加载新 View 时如何禁用 UISwipeGestureRecognizer?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11376389/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com