iOS获取程序目录的一些路径
获取沙盒目录路径的函数
NSString * homeDir = NSHomeDirectory();
获取Documents目录路径的方法
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *docDir = [paths objectAtIndex:0];
获取Caches目录路径的方法
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString * cachesDir = [paths objectAtIndex:0];
获取tmp目录路径的方法
NSString *tmpDir = NSTemporaryDirectory();
获取应用程序程序吧中资源文件路径的方法
NSString *imagePath = [[NSBundlemainBundle] pathForResource:@"apple"ofType:@"png"];
UIImage *appleImage = [[UIImage alloc] initWithContentsOfFile:imagePath];

浙公网安备 33010602011771号