Created
October 25, 2013 23:52
-
-
Save priore/7163607 to your computer and use it in GitHub Desktop.
Get file list with NSPredicate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // get file list with NSPredicate | |
| NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; | |
| NSFileManager *fm = [NSFileManager defaultManager]; | |
| NSArray *dirContents = [fm contentsOfDirectoryAtPath:bundlePath error:nil]; | |
| NSPredicate *fltr = [NSPredicate predicateWithFormat:@"self like '*.jpeg'"]; | |
| NSArray *fileNames = [[dirContents filteredArrayUsingPredicate:fltr] retain]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment