In a cocos2dx project, on iOS 10 devices, when the notification center is swiped down then up, a huge frame rate drop happens. As a result, when the animations resume ui elements whose motion depends on the delta t are moved to invalid positions. It looks to me that the OS is putting the app in some kind of a background mode but the applicationDidEnterBackground
is not called.
Is there a way to receive an event when the notification center is swiped down/up?
Asked
Active
Viewed 2,290 times
4

Vahagn
- 139
- 9
1 Answers
8
Use
applicationWillResignActive(_:)
The above delegate gets called when ur app leaves foreground. This is the same delegate that gets called when ur app momentarily looses focus like on receiving call etc.
You can use
applicationWillEnterForeground(_:)
to figure out when ur app regains the focus.
read : https://developer.apple.com/documentation/uikit/uiapplicationdelegate
As these delegates are called on App's UIApplicationDelegate
which is typically ur appDelegate file and most of the times you would like to get notified of these events in individual ViewControllers rather than in AppDelegate you can always use NotificationCenter
and add observer for UIApplicationWillResignActiveNotification

Sandeep Bhandari
- 19,999
- 5
- 45
- 78
-
Thank you for the answer. So `applicationWillResignActive` is definitely called when the notification center is swiped down on iOS10? – Vahagn Sep 04 '17 at 08:21
-
@vahagn : Logically yes, I don't think anything specifically changed in iOS 10. I have used these to handle the device recieving voice call scenario. So should work with this as well – Sandeep Bhandari Sep 04 '17 at 08:22
-
2@vahagn : read this https://stackoverflow.com/questions/9060066/sleep-mode-vs-notification-center-open this clearly mentions that applicationWillResignActive gets called on Notification Center pull down – Sandeep Bhandari Sep 04 '17 at 08:24