Objective-C Tips & Trick - Prioregroup.com
[Objective-C] Get file list with NSPredicate
       
back

// 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];






Copyright © 1996-2018 Centro Studi Informatica di Danilo Priore. All rights reserved. P.I.10149810581.
prioregroup.com