There are a number of apps that detect whether or not the user has taken a screenshot such as Snapchat and the Facebook app.
There have also been a few ideas on exactly how to do perform this detection.
Here’s library from Clay Allsop called ShotBlocker uses a simple technique to detect if the user has taken a screenshot by polling the camera roll based on a timer and checking if a new image has been added that matches the size of the user’s screen.
The library executes a callback block when a new screenshot is detected.
You can find ShotBlocker with usage instructions on Github here.
A simple solution to this problem. Chpwn has written on his blog about how taking screenshots cancels all screen touches so possibly using UILongPressGestureRecognizer and looking for the state to be UIGestureRecognizerStateCancelled rather than polling based on a timer could be a better approach.
- Open Source iOS Library For Detecting Apps Installed On A User’s Device
- Open Source iOS Control For Making Customizable Circular Progress Views
- iOS Library Providing An Easy Way To Record The Screen, Touches And User Simultaneously
- Open Source: Library For Creating Framed, Shadowed, Stacked Images Automatically For A Real Photo Look
- Open Source: Library For Easy USB And TCP Communication Within iOS/Mac Apps
Original article: Open Source iOS Library For Detecting When A User Is Taking A Screenshot
©2012 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.