【发布时间】:2016-08-17 07:06:32
【问题描述】:
我正在使用带有 roundedRect 和 CAShaplayer 的 UIBeizerPath 来附加到我的 UIView。我已经注释掉了填充,但它仍在填充矩形。
我要做的就是在外面画圆角矩形线。
我猜 roundedRect 是一个实体,我可能必须使用 UIBeizerPath 或用 clear 填充,但我找不到文档。
这是我的代码:
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)
感谢您的帮助
【问题讨论】:
标签: ios swift uibezierpath rounded-corners cashapelayer