Swift 顶部分隔线



    overridefuncdraw(_rect:CGRect) {

        guard let context = UIGraphicsGetCurrentContext() else {

            return

        }


        context.setStrokeColor(red:198/255.0, green:198/255.0, blue:198/255.0, alpha:1)

        context.setLineWidth(1/UIScreen.main.scale)

        context.strokePath()


        letstartPoint =CGPoint.init(x:17, y:0)

        letendPoint =CGPoint.init(x: rect.size.width-17, y:0)


        context.move(to: startPoint)

        context.addLine(to: startPoint)

        context.addLine(to: endPoint)

        context.strokePath()

    }

你可能感兴趣的:(Swift 顶部分隔线)