Created
July 7, 2011 02:31
-
-
Save sprite2005/1068798 to your computer and use it in GitHub Desktop.
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
- (IBAction) quickImport | |
{ | |
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; | |
[library enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos usingBlock:^(ALAssetsGroup *group, BOOL *stop) { | |
NSMutableArray* assets = [[NSMutableArray alloc] init]; | |
[group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) { | |
if (result) { | |
[assets addObject:result]; | |
} | |
}]; | |
ALAsset* lastAsset = [assets lastObject]; | |
ALAssetRepresentation* representation = [lastAsset defaultRepresentation]; | |
CGImageRef imageRef = [representation fullResolutionImage]; | |
if (imageRef) { | |
UIImage* image = [UIImage imageWithCGImage:imageRef]; | |
[self performOCROnImage:image withAnalysis:YES]; | |
} | |
[assets release]; | |
} failureBlock:^(NSError *error) { | |
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:nil message:@"To use this feature, please enable Location Services. To do so, go to Settings -> Location Services and turn it on for Word Cheat." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; | |
[alert show]; | |
[alert release]; | |
}]; | |
[library release]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment