开发者

Iphone : Problem regarding image Stored in Document Directory?

开发者 https://www.devze.com 2023-03-20 03:06 出处:网络
In a App. i am saving the images from server in Document Directory. In Database that images are came as \"image4_12:19:27.png\"

In a App. i am saving the images from server in Document Directory.

In Database that images are came as "image4_12:19:27.png"

in documents directory folder that images stored as "image4_12/19/27.png"

开发者_如何转开发

How that image convert "image4_12:19:27.png" to "image4_12/19/27.png" in Document Directory.

What should i do?


You can split the file name into parts separated by : and then later append them.

NSString * fileName = @"image4_12:19:27.png";
NSArray * components = [fileName componentsSeparatedByString:@":"];

NSString * relativeFilePath = [components componentsJoinedByString:@"/"];
NSString * absoluteFilePath = [documentsDirectory stringByAppendingPathComponent:components];

where documentsDirectory is the path to the documents directory.

0

精彩评论

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