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
Post a Comment