额外的论点' texture'在电话中

时间:2015-05-22 06:04:53

标签: ios swift

我在这里看到过类似的问题,但我是Swift的新手并以这种方式编程,所以我需要一个明确的例子。我收到错误额外参数'纹理'在电话中使用以下代码:

// Setup settings button
let settingsTexture = SKTexture(imageNamed: "settings")
let settingsButton2 = Button(texture: settingsTexture, color: UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.0), size: settingsTexture.size())
settingsButton2.position = CGPointMake(view.frame.size.width - settingsTexture.size().width - 10, self.frame.size.height - 30)
settingsButton2.setPressedAction(pressedSettingsButton)
self.addChild(settingsButton2)

我在第三行收到错误:

let settingsButton2 = Button(texture: settingsTexture, color: UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.0), size: settingsTexture.size())

2 个答案:

答案 0 :(得分:0)

试试这个:

let settingsButton2 = Button(settingsTexture, color: UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.0), size: settingsTexture.size())

答案 1 :(得分:0)

使用 -

更改您的行
let settingsButton2 = SKSpriteNode(texture: settingsTexture, color: UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.0), size: settingsTexture.size())