我使用UICeizerPath与roundedRect和CAShaplayer附加到我的UIView。我已经评论了填充,但它仍然填充矩形。Swift:UIBeizerPath CAShapelayer填充时填充注释
我想要做的就是在外面有圆角的矩形线条。
我猜roundRect是一个坚实的,我可能不得不使用UIBeizerPath或填写清楚,但我一直没有找到文件。
这是我的代码:
let rect: CGRect = frontview.bounds
var shape: UIBezierPath = UIBezierPath(roundedRect: rect, cornerRadius: 5.0)
var shapeLayer = CAShapeLayer()
shapeLayer.path = shape.CGPath
//shapeLayer.fillColor = UIColor(red: 0.5, green: 1, blue: 0.5, alpha: 1).CGColor
shapeLayer.strokeColor = UIColor.blackColor().CGColor
shapeLayer.lineWidth = 2
self.frontview.layer.addSublayer(shapeLayer)
感谢您的帮助
谢谢! –