ios - Handle App going background in middle of UILongPressgestureRecognizer -
ios - Handle App going background in middle of UILongPressgestureRecognizer -
in app using uilongpressgesturerecognizer add together subview view on uigesturerecognizerstatebegan
, removing view when gesture ends.
my problem is, when app goes background before ending gesture (by clicking home button or powerfulness button lock screen ) subview added still there when user resumes app (back foreground).
please suggest me way handle this. know - (void)applicationdidenterbackground:(uiapplication *)application
delegate in appdelegate
don't know how utilize delegate solve issue because functionality there in multiple uiviewcontroller
.
you can subscribe uiapplicationwillresignactivenotification notified when app come in background. each uiviewcontroller
can subscribe notification on own.
then can cancel gesture doing:
recognizer.enabled = no recognizer.enabled = yes
edit
as user1963877 suggested should check whether app going background causes gesture recognizer come in cancel state anyway. you'll have check in gesture handler , remove subview.
ios objective-c
Comments
Post a Comment