我正在尝试将SKSpriteNodes添加到函数中的视图中,但
Xcode不允许我这样做.它给了我错误“使用未解析的标识符’self’”
原文链接:https://www.f2er.com/swift/319013.htmlfunc indicate() { if test == 0 { var large = ((CGFloat(largest)*54) - 29) - selectedNode.position.x var small = selectedNode.position.x - ((CGFloat(smallest)*54) - 29) indicatorRight.position = CGPointMake(selectedNode.position.x + large,selectedNode.position.y) indicatorRight.userInteractionEnabled = true indicatorRight.zPosition = 0.5 indicatorLeft.position = CGPointMake(selectedNode.position.x - small,selectedNode.position.y) indicatorLeft.userInteractionEnabled = true indicatorLeft.zPosition = 0.5 println(indicatorLeft.position) // println(smallest) self.addChild(indicatorRight) self.addChild(indicatorLeft) } }