У мене вузол прямокутника:
let shape = SKShapeNode()
shape.path = UIBezierPath(roundedRect: CGRect(x: -128, y: -128, width: 256, height: 256), cornerRadius: 64).CGPath
shape.position = CGPoint(x: CGRectGetMidX(frame), y: CGRectGetMidY(frame))
shape.fillColor = UIColor.redColor()
shape.strokeColor = UIColor.blueColor()
shape.lineWidth = 10
addChild(shape)
Як додати радіус кордону 20 лише до кутів TopLeft та TopRight?
Відповіді:
3 для відповіді № 1Користувач це UIBezierPath
ініціалізатор:
public convenience init(roundedRect rect: CGRect, byRoundingCorners corners: UIRectCorner, cornerRadii: CGSize)
і вкажіть [.TopLeft, .TopRight]
для byRoundingCorners
аргумент
shape.path = UIBezierPath(
roundedRect: CGRect(x: -128, y: -128, width: 256, height: 256),
byRoundingCorners: [.TopLeft, .TopRight]
cornerRadii: CGSize(width: 64, height: 64)).CGPath