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.
我正在做 Apple 网站上 Xcode 11 操场上的 SwiftUI 教程,因为我使用的是 Mojave 而不是 Catalina。有一个名为turtlerock.jpg 的图像,但它没有显示在操场上。
我将图像放在资源文件夹中,但没有运气。
我也一直在为这个问题挠头。我现在至少找到了一种解决方法:
代替:
Image("turtlerock")
尝试:
Image(uiImage: UIImage(named: "turtlerock.jpg")!)
您必须在 Playground 的 Resources 文件夹中拥有 turtlerock.jpg。如果你先把它变成一个.png,你可以UIImage(named: "turtlerock")在上面使用。
UIImage(named: "turtlerock")