views:

26

answers:

1

I've got a bunch of resources -- images, to be specific -- which are all stuck in a resource group via XCode.

I know how to load a specific image file from within that resource group by specifying the filename and using inDirectory to specify the "path" to the group it's in.

But is it possible to obtain (programatically) a list of all the files in a certain group? The app I'm building displays a random image from among all the ones in a specific folder. While I could obviously just create a hard-coded array containing a list of all those files, it would be pretty convenient to be able to add more files just by dropping them into the folder.

So: Can it be done?

Thanks!

+3  A: 

What about using the pathsForResourcesOfType:inDirectory: method of the NSBundle class?

It will return you a NSArray with the path of files matching the given type.

Macmade
That's exactly what I was looking for. Thanks!!
DanM