Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用“为任何添加的文件夹递归创建组”在我的 xcode 项目中添加了一个名为“Audio”的文件夹。
该文件夹包含一些音频歌曲。我想生成一个歌曲列表,动态地从添加的文件夹中获取歌曲。请帮助我如何做到这一点。
如果使用文件夹引用添加文件夹,我可以创建歌曲列表。但我不希望那样。
这应该有效:
NSArray * thelist =[[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:nil];
直接来自文档:https ://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/nsfilemanager_Class/Reference/Reference.html