📜  swift 5 进度条高度 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:00:59.054000             🧑  作者: Mango

代码示例1
//Create a custom class of UIProgressView and override the layoutSubviews function
//Also add a height constraint to the ProgressView on the storyboard

override func layoutSubviews() {
        super.layoutSubviews()

        let maskLayerPath = UIBezierPath(roundedRect: bounds, cornerRadius: 4.0)
        let maskLayer = CAShapeLayer()
        maskLayer.frame = self.bounds
        maskLayer.path = maskLayerPath.cgPath
        layer.mask = maskLayer
    }