iphone - how to get multiple types of file using pathsForResourcesOfType -


i need access jpg,png,bmp in resources folder, doing following gives me jpg... algorithmically wrong? or there shorter, simpler syntax makes me access 3 @ once? please me out..

nsmutablearray *paths = [[[nsbundle mainbundle] pathsforresourcesoftype:@"jpg" indirectory:nil] mutablecopy]; nsmutablearray *paths2 = [[[nsbundle mainbundle] pathsforresourcesoftype:@"png" indirectory:nil] mutablecopy]; nsmutablearray *paths3 = [[[nsbundle mainbundle] pathsforresourcesoftype:@"bmp" indirectory:nil] mutablecopy];  for(nsstring *filename in paths) {     filename = [filename lastpathcomponent];     nslog(@" filename %@", filename);     [filenames addobject:filename];     nslog(@" filenames array length %d", [filenames count]); } 

and on paths2 , paths3...

you can specify nil extension retrieve bundle resources. then, in for loop, check [filename pathextension].


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -