Skip to content

Instantly share code, notes, and snippets.

@sdgandhi
Created May 21, 2015 23:11
Show Gist options
  • Save sdgandhi/1b9649fb7256e06fad58 to your computer and use it in GitHub Desktop.
Save sdgandhi/1b9649fb7256e06fad58 to your computer and use it in GitHub Desktop.
iOS — Save image to documents directory
// Create path.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:<#@"Image.png"#>];
// Save image.
[UIImage<#PNG#>Representation(image) writeToFile:filePath atomically:<#YES#>];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment