【发布时间】:2014-05-13 13:22:09
【问题描述】:
我正在使用 Assets Catalog,在资产中添加各种大小的应用程序图标是可以的。
但是当我尝试以编程方式获取 UIImage 时,它返回 nil。
UIImage *appIcon = [UIImage imageNamed"AppIcon"];
应用图标名为AppIcon(默认),实际文件为app-icon-256.png等。
我还注意到,与普通图像不同,应用程序图标位于目录AppIcon.appiconset 中的“应用程序图标”集中。普通图片在someimage.imageset目录下。
【问题讨论】:
-
您需要指定文件结尾。即文件名.png
-
@Rax,不,你没有。
On iOS 4 and later, if the file is in PNG format, it is not necessary to specify the .PNG filename extension. -
"AppIcon.png" 或 "AppIcon.jpg" 无论你的扩展是什么,都可以工作!
-
@Rax,那没用。你能确认一下吗?
-
具有讽刺意味的是,请在此处查看@samwize 答案:stackoverflow.com/a/51241158/397210
标签: ios objective-c xcode uiimage