I am making an iPhone app using Xcode and following is the directory structure
GFGGAME
-gfggame.xcodeproj
-Images
--bagold
---bags_1.png
---bags_2.png
--bagsnew
---bags_5.png
---bags_6.png
I want to access all images from folder bagsold
and bagsnew
. If I use resource path and a predicate filter for png it gives me all the png files . Is there a way i can access just the files present in the folder.
I think you probably want to use this NSBundle
method:
+ (NSArray *)pathsForResourcesOfType:(NSString *)extension inDirectory:(NSString *)bundlePath
See API docs here
You would pass @".png"
as your extension, and then specify the directory path just for the subdirectories you want (you might need to call this twice, one for each subdirectory, and then just append the second array of paths to the first).
See a similar question on Stack Overflow here
Note the point in the answer (link) above, about what you need to do in Xcode to make this work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With