Return to Snippet

Revision: 29042
at July 20, 2010 05:59 by rabc


Initial Code
NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] 
							stringByAppendingPathComponent:@"images"];
	
// save the file
NSString *imagePath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png", 
																[imageName stringByReplacingOccurrencesOfString:@" " withString:@"_"]]];
if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) {
	// delete if exist
	[[NSFileManager defaultManager] removeItemAtPath:imagePath error:nil];
}
	
NSData *imageDate = [NSData dataWithData:UIImagePNGRepresentation(image)];
	
[imageDate writeToFile: imagePath atomically: YES];

Initial URL

                                

Initial Description

                                

Initial Title
Save image to Documents folder

Initial Tags
image, iphone

Initial Language
Objective C