如何获取仅保存在iphone应用程序的文档文件夹中的所有照片名称 [英] How to get all the names of photos only which are saved in documents folder of iphone application

查看:107
本文介绍了如何获取仅保存在iphone应用程序的文档文件夹中的所有照片名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望将所有照片名称保存在我的文档文件夹中。因为它包含除图像以外的一些资源,我需要从文档文件夹中选择图像,然后在数组中填充图像的名称。

i want to get all the photos names saved in my documents folder .as it contains some resources other than images,i need to select the images itelf from the documents folder and populate the names of images in an array.

推荐答案

NSString *documentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSArray *dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDir error:nil];
NSArray *onlyPics = [dirContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self ENDSWITH '.png'"]];

这篇关于如何获取仅保存在iphone应用程序的文档文件夹中的所有照片名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆