Skip to content

Instantly share code, notes, and snippets.

@alekseypotapov-dev
Created March 6, 2015 12:36
Show Gist options
  • Save alekseypotapov-dev/691d8f900e257862a70d to your computer and use it in GitHub Desktop.
Save alekseypotapov-dev/691d8f900e257862a70d to your computer and use it in GitHub Desktop.
Save image to Documents folder
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:
[NSString stringWithFormat:@"savedImage%lu.png",arrayOfImages.count]];
NSData *imageData = UIImagePNGRepresentation(imageObject);
[imageData writeToFile:savedImagePath atomically:NO];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment