Nil与预期的论点不兼容

时间:2017-01-04 17:24:09

标签: swift xcode path null var

我定义了一个名为path的CGMutablePath()和一个名为rect的SKShapeNode():

    var path = CGMutablePath()
    var path = CGMutablePath()

然后我尝试显示矩形:

    let rect = CGRect(x: 0, y: 0, width: self.size.width, height: self.size.height/2-36)
    CGPathAddRect(path, nil, rect)
    shapeNode.path = path
    shapeNode.lineWidth = 0
    shapeNode.fillColor = SKColor.black
    shapeNode.zPosition = 1
    self.addChild(shapeNode)

但是我得到以下错误:

     Nil is not compatible with expected argument type 'UnsafePointer<CGAfineTransform>'

在上一段代码的第二行:

    CGPathAddRect(path, nil, rect)

它刚刚开始通过swift 3更新给我这个错误,我该怎么办?

0 个答案:

没有答案