【发布时间】:2015-05-11 04:13:13
【问题描述】:
我正在尝试从.xcassets 文件中的LaunchImage 图像集加载图像,但我不想确实使用imageNamed:,因为它会浪费内存和图像只需在初始启动期间显示几秒钟。
我已经尝试了多种方法,但到目前为止我只能使用imageNamed: 加载它们。
这行得通:
[UIImage imageNamed:@"LaunchImage-700-568h.png"]
这不起作用(返回null):
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"LaunchImage-700-568h" ofType:@"png"]]
有什么方法可以在不将资源显式添加到目标(资产文件除外)的情况下做到这一点?谢谢!
【问题讨论】:
标签: ios objective-c xcode uiimage imagenamed