Search code examples
iphoneobjective-cios5xcode4.2

How can I store an image programmatically in my apps folder at iPhone apps?


Possible Duplicate:
Save An Image To Application Documents Folder From UIView On IOS

I want to store image in my apps folder programmatically which I taken by UIImagePiker (camera or photogallery). I am a beginner in iOS programming.


Solution

  • Saving an image:

    -(void)saveImage:(UIImage*)image
    {
        NSString  *imagePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/aName.png"];
    
       [UIImagePNGRepresentation(image) writeToFile:imagePath atomically:YES];
    
    }