Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道可以直接拖入UIImageSwift 代码,看起来像这样
UIImage
但不知何故,我无法让它工作。
我试图将image@3x.png从资源拖到代码中,但拖到的图像指向其他图像,需要知道如何让这些图像文字工作。
您的 Assets.xcassets 文件夹中必须有该图像。然后在输入图像文字自动完成后双击图标并从集合中选择您的图像。如果您有太多图像,并且您仍想使用 Image 文字,请注释 ImageLiteral 行,并将确切名称写入 #imageLiteral 的 init 中,如下所示: // #imageLiteral(resourceName: "NameOfYOurPicture") 然后取消注释它,您将在那里拥有您的图像
// #imageLiteral(resourceName: "NameOfYOurPicture")