Created
November 25, 2014 02:00
-
-
Save ianb821/14b6d2337544a3e5394b to your computer and use it in GitHub Desktop.
Grabbing Screenshot on Lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To get the background I use _UICreateScreenUIImage(); | |
Here's the declaration: | |
OBJC_EXTERN UIImage *_UICreateScreenUIImage(void) NS_RETURNS_RETAINED; | |
Specifically I hook SBBackLightController. Here is the bare bones of what I use: | |
%hook SBBacklightController | |
- (void)animateBacklightToFactor:(CGFloat)factor duration:(double)duration source:(int)source completion:(void (^)(void))completion { | |
if (factor < 0.1) { | |
UIImage *currentBackground = _UICreateScreenUIImage(); | |
// Do whatever with currentBackground | |
} | |
%orig; | |
} | |
%end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment