路径目录可用于iOS

路径目录可用于iOS

本文介绍了路径目录可用于iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

NSSearchPathDirectory

这些常量指定各种目录的位置。

enum {
   NSApplicationDirectory = 1,
   NSDemoApplicationDirectory,
   NSDeveloperApplicationDirectory,
   NSAdminApplicationDirectory,
   NSLibraryDirectory,
   NSDeveloperDirectory,
   NSUserDirectory,
   NSDocumentationDirectory,
   NSDocumentDirectory,
   NSCoreServiceDirectory,
   NSAutosavedInformationDirectory = 11,
   NSDesktopDirectory = 12,
   NSCachesDirectory = 13,
   NSApplicationSupportDirectory = 14,
   NSDownloadsDirectory = 15,
   NSInputMethodsDirectory = 16,
   NSMoviesDirectory = 17,
   NSMusicDirectory = 18,
   NSPicturesDirectory = 19,
   NSPrinterDescriptionDirectory = 20,
   NSSharedPublicDirectory = 21,
   NSPreferencePanesDirectory = 22,
   NSItemReplacementDirectory = 99,
   NSAllApplicationsDirectory = 100,
   NSAllLibrariesDirectory = 101
};
typedef NSUInteger NSSearchPathDirectory;

在这些路径目录中,我知道NSCachesDirectory和NSDocumentDirectory在iOS中是可用的。你是否知道其他人是否也是这样?

Among those path directory, I know that NSCachesDirectory and NSDocumentDirectory are usable in iOS. Do you know if some others are too ?

目前我正在NSCachesDirectory中下载图像,我使用[UIImage imageNamed:]在屏幕上打印图片。但是我正在寻找一个更明确的文件夹来存储我的图像。

For the moment I'm downloading images in NSCachesDirectory and I use [UIImage imageNamed:] to print pictures at the screen. But I'm looking for a more explicit folder to store my images.

谢谢,

推荐答案

据我所知,只有这些可在iOS上使用:

As far as I know only these are usable on iOS:

NSDocumentDirectory is Documents/     (persistent, backed up, may be visible in iTunes)
NSLibraryDirectory is Library/     (persistent, backed up, not visibe to the user)
NSCachesDirectory is Library/Caches/     (not backed up, may be cleared by system)

此外,还有:

NSTemporaryDirectory() is tmp/     (not backed up, *will* be cleared by system)

所有路径都与应用程序沙箱目录相关,您应该能够写入所有路径。所有这些目录具有不同的行为,适用于不同类型的文件。

All paths are relative to application sandbox directory and you should be able to write to all of them. All those directories have different behavior and are for different types of files.

为了存储图像,我将创建目录图书馆,让我们说图书馆/缩略图/ 。如果图像容易被重新启用或可下载,那么您应该创建并使用 Library / Caches / Thumbnails /

For storing the images, I would create directory in Library, let's say Library/Thumbnails/. If the images are easily recreatable or downloadable, then you should create and use Library/Caches/Thumbnails/.

这篇关于路径目录可用于iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 02:37