圆角矩形

圆角矩形

 override func draw(_ rect: CGRect) {
        let context = UIGraphicsGetCurrentContext()
        context?.move(to: CGPoint(x: 110, y: 100))

        context?.addArc(tangent1End: CGPoint(x: 200, y: 100), tangent2End: CGPoint(x: 200, y:200), radius: 10)
        context?.addArc(tangent1End: CGPoint(x: 200 , y: 200), tangent2End: CGPoint(x: 100, y:200), radius: 10)

        context?.addArc(tangent1End: CGPoint(x: 100 , y: 200), tangent2End: CGPoint(x: 100, y:100), radius: 10)
        context?.addArc(tangent1End: CGPoint(x: 100 , y: 100), tangent2End: CGPoint(x: 200, y:100), radius: 10)

        context?.setStrokeColor(UIColor.orange.cgColor)
        context?.setLineWidth(5)
        context!.strokePath()
  
    }

你可能感兴趣的:(圆角矩形)