-->

UIPanGestureRecognizer不主叫端状态(UIPanGestureRecognize

2019-10-19 12:09发布

使用UIPanGestureRecognizer我们正朝着电池在UICollectionView

当我们开始拖动UIGestureRecognizerStateBegan被调用。 但是,当我们仍持有中拖动单元格并按下Home键在ipad中, UIPanGestureRecognizer没有要求UIGestureRecognizerStateEndedUIGestureRecognizerStateFailedUIGestureRecognizerStateCancelled ,甚至没有打电话的手势方法

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

当我从后台打开我的应用程序的电池是在视图中的同一个地方,但我不能对其执行任何操作。 这是因为UIPanGestureRecognizer不调用gestureStates。

如何结束我的UIPanGestureRecognizer当用户按下主页按钮。

Answer 1:

尝试这个

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

        [self.window setUserInteractionEnabled:NO];

    }



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

        [self.window setUserInteractionEnabled:YES];
    }


文章来源: UIPanGestureRecognizer not calling End state