gpt4 book ai didi

ios - UIPanGestureRecognizer 不调用结束状态

转载 作者:行者123 更新时间:2023-11-29 12:51:53 24 4
gpt4 key购买 nike

使用 UIPanGestureRecognizer 我们正在移动 UICollectionView 中的单元格

当我们开始拖动时 UIGestureRecognizerStateBegan 被调用。但是当我们仍然按住拖动单元格并按下 ipad 中的主页按钮时,UIPanGestureRecognizer 不调用 UIGestureRecognizerStateEndedUIGestureRecognizerStateFailedUIGestureRecognizerStateCancelled,甚至不调用手势方法

- (void)handlePanGesture:(UIPanGestureRecognizer *)gestureRecognizer;

当我从后台打开我的应用程序时,单元格位于 View 中的同一位置,但无法对其执行任何操作。这是因为 UIPanGestureRecognizer 没有调用 gestureStates。

如何在用户按下主页按钮时结束我的 UIPanGestureRecognizer

最佳答案

试试这个

    - (void)applicationWillResignActive:(UIApplication *)application {

[self.window setUserInteractionEnabled:NO];

}



- (void)applicationDidBecomeActive:(UIApplication *)application {

[self.window setUserInteractionEnabled:YES];
}

关于ios - UIPanGestureRecognizer 不调用结束状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22247920/

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