gpt4 book ai didi

iPhone SDK : subFolders inside the main bundle

转载 作者:行者123 更新时间:2023-12-03 18:29:53 26 4
gpt4 key购买 nike

在当前项目中,我有许多带有子文件夹的文件夹,其中包含图像:01.png、02.png。

文件夹1/文件夹A/f1.png文件夹1/文件夹B/F1.png

当我编译应用程序时,我查看了 .app 内部,发现所有图像都放置在顶层,没有子文件夹。

很明显,当尝试加载图像时,这是行不通的:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"f1" 类型:@"png" inDirectory:@"Folder1/FolderA"];

但更奇怪的是,当加载图像“f1”时,图像实际上加载了“F1”

UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"f1.png"]];

有人知道如何解决这个问题吗?

是否有编译选项可以在应用程序包中创建文件夹?

TIA。

最佳答案

要在 .app 包内创建子文件夹,您应该选中“为任何添加的文件夹创建文件夹引用”选项,而不是默认的“为任何添加的文件夹递归创建组”现在在 XCode 中,导入的文件夹显示为蓝色而不是黄色。构建并运行,您应该会在 .app 文件中看到文件夹。

关于iPhone SDK : subFolders inside the main bundle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2398459/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com