在不使用 SKShapeNode(IOS 7 兼容)的情况下在 swift 精灵套件中绘制圆圈的最佳方法?

Best way to draw a circle in swift sprite kit without using SKShapeNode (IOS 7 Compatible)?

在 swift sprite kit WITHOUT 中使用 SKShapeNode 绘制圆圈的最佳方法是什么?问题是 SKShapeNode(circleOfRadius: 100) 似乎不适用于 iOS 7.

这是 iOS 7.1 错误:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SKShapeNode shapeNodeWithCircleOfRadius:]: unrecognized selector sent to class

需要的功能:

提前感谢您的任何建议。

如文档所述 here circleOfRadius 它仅在 iOS 8.0 及更高版本中可用。 但是您可以使用 SKShapeNode(在 iOS 7.0 及更高版本中可用)并将 UIBezierPath(ovalInRect:) 设置为 path 属性(在 iOS 7.0 及更高版本中可用)作为关注:

let myShape = SKShapeNode()
myShape.path = UIBezierPath(ovalInRect: CGRectMake(0, 0, 100, 100)).CGPath
myShape.position = CGPointMake(view.scene!.frame.midX-50, view.scene!.frame.midY-50)
myShape.fillColor = UIColor.redColor()
myShape.strokeColor = UIColor.blueColor()
myShape.lineWidth = 10
self.addChild(myShape)