How to get all the names of photos only which are saved in documents folder of iphone application

≡放荡痞女 提交于 2019-12-23 01:36:20

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/7865544/how-to-get-all-the-names-of-photos-only-which-are-saved-in-documents-folder-of-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!