我在 xcode 中的图像 Assets 中创建了一个名为 weather-large
的文件夹,其中有一个我想访问的文件,名为 clouds.png
所以我尝试以这种方式访问它:
weatherImageView.image = UIImage(contentsOfFile: "weather-large/clouds")
也这样试过:
weatherImageView.image = UIImage(named: "weather-large/clouds")
但是当我可以在根目录中访问它时,它们都不起作用。我做错了什么?
最佳答案
这个文件夹只是为了对 Assets 进行分组。尝试:
weatherImageView.image = UIImage(named: "clouds")
关于ios - 无法从 Assets 中选择文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32501322/