UIImage Saving image with file name on the iPhone

后端 未结 3 1207
迷失自我
迷失自我 2020-11-28 13:50

How can I save an image (like using UIImageWriteToSavedPhotosAlbum() method) with a filename of my choice to the private/var folder?

3条回答
  •  日久生厌
    2020-11-28 14:37

    Kenny, you had the answer! For illustration I always think code is more helpful.

    //I do this in the didFinishPickingImage:(UIImage *)img method
    
    NSData* imageData = UIImageJPEGRepresentation(img, 1.0);
    
    
    //save to the default 100Apple(Camera Roll) folder.   
    
    [imageData writeToFile:@"/private/var/mobile/Media/DCIM/100APPLE/customImageFilename.jpg" atomically:NO]; 
    

提交回复
热议问题