开发者

Where should I save images in my iPhone app?

开发者 https://www.devze.com 2023-01-01 04:12 出处:网络
I am developing an application for iphone that will pick an image from photo library and save it at some other place.Now in my application i will be using this image later on from that place.

I am developing an application for iphone that will pick an image from photo library and save it at some other place.Now in my application i will be using this image later on from that place.

So can anybody suggest the fol开发者_如何学运维der where should i save this image so that the application works perfectly on device also.


You want to save it your applications Documents or Library folder. See the Files and Networking Programming Guide and specifically something like:

"Listing 6-1 Getting a file-system path to the application’s Documents/ directory:"

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];


Have a look at this snippet http://snipplr.com/view/28080/save-image-example/, each application has a 'Documents' folder where you could save the image too.


You would save it to the applications document or library folder. If you want the user to have access to it on the iPad, put it in the documents folder. If only code will access it, put it in the library folder.

0

精彩评论

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