我在使用UIImage创建SKSpriteNode时遇到问题.我正在使用PaintCode创建我用于App的资源(PaintCode使用绘图方法和图像方法创建一个Swift文件,允许我显示创建的图像).
我现在的问题是我想使用我的PaintCode图像创建一个简单的SKSpriteNode,但我不知道如何将它们添加到SpriteNode.
我试过这样的事情(第18行):
let Bottom = SKSpriteNode(texture: SKTexture(image: StyleKitName.drawBottom(frame: CGRect(x: 50, y: 50, width: 50, height: 50), isWinter: false)))
Run Code Online (Sandbox Code Playgroud)
但它返回以下错误:
/Users/myMacName/Documents/App Development/AppName/AppName/GlobalFunctions.swift:18:44: Cannot find an initializer for type 'SKTexture' that accepts an argument list of type '(image: ())'
Run Code Online (Sandbox Code Playgroud)
StyleKitName.drawBottom函数返回一个UIImage.如果有人能告诉我如何用UIImage创建一个SKSpriteNode,那将是很好的.
我感谢任何帮助.谢谢.