简体   繁体   中英

iOS - Detect if user is touching the screen outside of the application sandbox

The question is actually in the title of the topic. I know that there are events for touchesBegan and etc. to identify touches INSIDE your application sandbox. But the problem is - is it possible to check touches when your application is in background? I want to determine user inactivity with device and do something inside the application (eg device was left somewhere) If yes - I would really appreciate the code snippet in Swift.

Thanks much!

Touch events go to a specific view. A view is owned by a specific app.

If an app is in the background then none of its views are being displayed. Therefore there is no way for an app in the background to get any sort of touch events.

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