📅  最后修改于: 2022-03-11 15:00:59.054000             🧑  作者: Mango
//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
}