开发者

Iphone : Problem regarding image Stored in Document Directory?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜