开发者

how to store image in local iphone bundel

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜