Created
January 13, 2013 09:02
-
-
Save benvium/4523079 to your computer and use it in GitHub Desktop.
Write UIImage to documents directory
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
| // UIImage called 'image' | |
| NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
| NSString *documentsDirectory = [paths objectAtIndex:0]; | |
| NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"foo.png"]; | |
| NSData *imageData = UIImagePNGRepresentation(image); | |
| [ imageData writeToURL:[NSURL fileURLWithPath:filePath] atomically:YES]; | |
| NSLog(@"written to %@", filePath); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment