且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

资产目录:访问不同文件夹中具有相同名称的图像

更新时间:2023-10-10 14:12:46

单击资产目录中的每个文件夹,然后在Utilities视图中选择提供命名空间

Click on each folder in the assets catalog and select Provides Namespace in the Utilities View:

您将看到该文件夹​​变为蓝色,您可以看到上面图像的路径图片。

You will see that the folder then becomes blue and you can see the path to the image above the images.

然后您可以像这样访问图片:

You can then access the image like this:

imageView.image = UIImage(named: "folder1/Image")

或在Objective-C中:

or in Objective-C:

imageView.image = [UIImage imageNamed:@"folder1/Image"];