Swift / SpriteKit - SKShapeNode的路径是空心的(空)

时间:2014-08-27 17:34:57

标签: swift sprite-kit ios8 xcode6

我想在两个圆圈之间划一条线。圆圈很好,但是线条已经勾勒出来,内部空洞。我希望线条是实心的,而不是"轮廓线"。以下是绘制线条的代码,后面是截图。

var line = SKShapeNode()
var path = CGPathCreateMutable()

// touch object stores startPosition and endPosition
CGPathMoveToPoint(path, nil, touch!.startPosition.x, touch!.startPosition.y)
CGPathAddLineToPoint(path, nil, touch!.endPosition!.x, touch!.endPosition!.y)

line.path = path
line.lineWidth = 10
line.fillColor = UIColor.blackColor() // Not sure if this line is actually needed
line.strokeColor = UIColor.blackColor()
self.nodeLayer.addChild(line)

http://imgur.com/DRVekcR(由于声誉而无法发布嵌入图片)

0 个答案:

没有答案