UIPanGestureRecognizer not calling End state

只谈情不闲聊 提交于 2019-12-11 08:34:49

问题


using UIPanGestureRecognizer we are moving the cells in the UICollectionView

When we started dragging UIGestureRecognizerStateBegan is called. but when we still holds the dragging cell and presses the Home Button in ipad, the UIPanGestureRecognizer not calling UIGestureRecognizerStateEnded or UIGestureRecognizerStateFailed or UIGestureRecognizerStateCancelled, not even calling gesture method

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

When i opened my app from background the cell is at the same place in the view but am not able to perform any actions on it. this is because of UIPanGestureRecognizer not calling the gestureStates.

How to end my UIPanGestureRecognizer when user presses the home button.


回答1:


try this

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

        [self.window setUserInteractionEnabled:NO];

    }



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

        [self.window setUserInteractionEnabled:YES];
    }


来源:https://stackoverflow.com/questions/22247920/uipangesturerecognizer-not-calling-end-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!