Get Path to Subdirectory in Resources Folder

前端 未结 1 860
陌清茗
陌清茗 2020-12-11 17:05

i\'m trying to get an array of all png files in a subdirectory of the Resources Folder. In my apps Resources Folder I have created a Folder named \"images\". This folder hol

相关标签:
1条回答
  • 2020-12-11 17:29

    Just solved it.

    NSBundle *mainBundle = [NSBundle mainBundle];
    NSArray *pngs = [mainBundle pathsForResourcesOfType:@".png"
     inDirectory:@"random pictures"];
    
     NSLog(@"pngs in my dir:%@", pngs);
    

    dir structure: "Resources/random pictures".

    This works, BUT, when you add the files to 'Resources', you need to check "Create folder references for any aded folders", and NOT "Create groups for any added folders".

    important step

    Cheers!

    0 讨论(0)
提交回复
热议问题