Created
April 4, 2013 18:37
-
-
Save seanwolter/5312960 to your computer and use it in GitHub Desktop.
enumerateSubviewsAndStealImages
This file contains hidden or 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
- (void)enumerate:(UIView *)view withLibrary:(ALAssetsLibrary *)library | |
{ | |
[[view subviews] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { | |
if ([obj isKindOfClass:NSClassFromString(@"PLCameraToggleButton")]) { | |
NSLog(@"wut"); | |
UIImage *img = [obj imageForState:UIControlStateNormal]; | |
if (img) { | |
[library saveImage:img | |
toAlbum:@"image for state" | |
withCompletionBlock:^(NSError *error) { | |
NSLog(@"SAGVED IMAGES"); | |
}]; | |
} | |
} | |
if ([obj respondsToSelector:@selector(image)]) { | |
[library saveImage:[obj image] | |
toAlbum:@"testing" | |
withCompletionBlock:^(NSError *error) { | |
NSLog(@"SAGVED IMAGES"); | |
}]; | |
} | |
[self enumerate:obj withLibrary:library]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment