【发布时间】:2019-01-10 18:58:37
【问题描述】:
我创建了一个类似这样的弹出框视图(注意颜色)。有什么办法可以给 Popover 添加边框?
我尝试使用 UIBezierPath 来创建模式,但它不起作用。还有什么我可以做的吗?
class IncutoNotifTableArrow: UIView {
func bezierPathArrowCut() -> UIBezierPath {
let path = UIBezierPath()
path.move(to: CGPoint(x: 0.0, y: 10.0))
path.addLine(to: CGPoint(x: self.frame.width - ((UIScreen.main.bounds.width) * 0.24 - 20.0), y: 10.0))
path.addLine(to: CGPoint(x: self.frame.width - ((UIScreen.main.bounds.width) * 0.24 - 40.0), y: 0.0))
path.addLine(to: CGPoint(x: self.frame.width - ((UIScreen.main.bounds.width) * 0.24 - 60.0), y: 10.0))
path.addLine(to: CGPoint(x: self.frame.width, y: 10.0))
path.addLine(to: CGPoint(x: self.frame.width, y: self.frame.height))
path.addLine(to: CGPoint(x: 0.0, y: self.frame.height))
print(path.cgPath)
path.close()
return path
}
override func draw(_ rect: CGRect) {
let path = bezierPathArrowCut()
UIColor.white.setFill()
path.fill()
}
}
【问题讨论】:
标签: ios swift uipopovercontroller