开发者

how to store image in local iphone bundel

开发者 https://www.devze.com 2023-02-05 22:00 出处:网络
i have one application in that i download all data in local . in this data also image coming i want to store this ima开发者_高级运维ge in local .

i have one application in that i download all data in local .

in this data also image coming i want to store this ima开发者_高级运维ge in local .

can i store this image in local? if yes ! how ?

from online image path (url) coming.


Save the image in UIImage and then save it to local like this;

NSData *imageData = UIImagePNGRepresentation(image);
        NSString *imageName = [NSString stringWithFormat:@"image.png"];

        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *fullPathToFile = [documentsDirectory stringByAppendingPathComponent:imageName];
        [imageData writeToFile:fullPathToFile atomically:YES];
0

精彩评论

暂无评论...
验证码 换一张
取 消