【发布时间】:2023-03-23 13:30:01
【问题描述】:
我创建了一个名为 applausible.bundle 的包,我将包放在了支持文件中。这是我的代码
NSBundle* myBundle;
myBundle = [NSBundle bundleWithPath:@"/Library/applausible.bundle"];
NSString *path = [myBundle pathForResource:@"splash.png" ofType:nil];
[imageName setImage:[UIImage imageNamed:path]];
这里我无法在图像视图上显示图像。我尝试过的另一种方法是在运行应用程序时使用 xib 将图像放置在图像视图上。输出在控制台中是这样的
无法加载从标识符为“com.xxxxxxx.ImageSample”的捆绑包中的笔尖引用的“splash_screen high resolution.png”图像。谁能告诉我哪里出错了。最后我的目标是在外部捆绑包中的UIImageview 上显示图像。
【问题讨论】:
-
请将您的问题格式化为可读格式。
-
将日志 stmt 放在 NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"applausible" ofType:@"Bundle"];并在您的图像路径旁边....
-
捆绑路径显示完美但图片路径为空
-
图片路径也来了但是图片不显示
-
如果我的回答对您有帮助,请尝试投票。或在我的答案上添加评论,以便下次改进答案