无法将 UIImage 类型的值转换为预期的参数类型字符串
cannot convert value of type UIImage to expected argument type string
我对 swift 有一些疑问。
Ground = SKSpriteNode(imageNamed: "#imageLiteral(resourceName: "Ground")")
这里说 "cannot convert value of type UIImage to expected argument type string" 我该如何解决这个问题
也许我遗漏了什么,但你为什么要添加这个?
#imageLiteral(resourceName:
正确的语法是
let ground = SKSpriteNode(imageNamed: "Ground")
我在做 :
profileImgView.image = UIImage(named: #imageLiteral(resourceName: "default_UserImage"))
虽然应该是:
profileImgView.image = #imageLiteral(resourceName: "default_UserImage")
imageLiteral 已经 return UIImage.
我对 swift 有一些疑问。
Ground = SKSpriteNode(imageNamed: "#imageLiteral(resourceName: "Ground")")
这里说 "cannot convert value of type UIImage to expected argument type string" 我该如何解决这个问题
也许我遗漏了什么,但你为什么要添加这个?
#imageLiteral(resourceName:
正确的语法是
let ground = SKSpriteNode(imageNamed: "Ground")
我在做 :
profileImgView.image = UIImage(named: #imageLiteral(resourceName: "default_UserImage"))
虽然应该是:
profileImgView.image = #imageLiteral(resourceName: "default_UserImage")