मेरे पास एक आयत नोड है:
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)
मैं केवल TopLeft और TopRight कोनों में 20 की सीमा त्रिज्या कैसे जोड़ूं?
उत्तर:
जवाब के लिए 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