iphone - Getting all resources with a name starting with 001XXX.jpg -



iphone - Getting all resources with a name starting with 001XXX.jpg -

i'm developing iphone , ipad application latest sdk , xcode 4.2.

i want retrieve path resources name start 001. name 001xxx.jpg (xxx unknown). don't know how many resources are.

for example, have bundle in app next files:

001001.jpg 001002.jpg 001003.jpg

i want nsarray path each of 3 files.

you can in 2 steps:

use nsbundle pathsforresourcesoftype:indirectory: method retrieve png files. use nsarray filteredarrayusingpredicate: method filter out pattern want.

the code (not tested) like:

nsarray *files = [[nsbundle mainbundle] pathsforresourcesoftype:@"png" indirectory:@"."]; nspredicate *pred = [nspredicate predicatewithformat:@"self beginswith[c] '001'"]; nsarray *images = [files filteredarrayusingpredicate:pred];

iphone objective-c ios filepath

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -