简体   繁体   中英

How do I detect a swipe to view notifications or control panel

I notice that my app backgrounds when I swipe from the top or bottom of my screen to view notifications or control panel. How can I detect when these events happen?

When you swipe to view the notifications panel, the app doesn't remain active. This method is fired up when the app loses focus. In your AppDelegate file, add the following method:

func applicationWillResignActive(_ application: UIApplication) {
}

To detect when the notification panel is removed ie swiped up, use

func applicationDidBecomeActive(_ application: UIApplication) {
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM