我绘制了2个自定义和视图,并希望将它们实现到我的页面控制器中,而不是标准点中,怎么办?
这是我的自定义视图
class CustomPageControlViewMain: UIView {
override func draw(_ rect: CGRect) {
super.draw(rect)
let path = UIBezierPath(ovalIn: rect)
UIColor.init(displayP3Red: 243/255, green: 114/255, blue: 30/255, alpha: 1).setFill()
path.fill()
}
}
class CustomPageControlViewOther: UIView {
override func draw(_ rect: CGRect) {
super.draw(rect)
let rect = CGRect(x: rect.origin.x + rect.width * 0.1, y: rect.origin.y + rect.height * 0.1, width: rect.width * 0.8, height: rect.height * 0.8)
let path = UIBezierPath(ovalIn: rect)
UIColor.init(displayP3Red: 243/255, green: 114/255, blue: 30/255, alpha: 1).setFill()
path.fill()
let rect2 = CGRect(x: rect.origin.x + rect.width * 0.05, y: rect.origin.y + rect.height * 0.05, width: rect.width * 0.9, height: rect.height * 0.9)
let path2 = UIBezierPath(ovalIn: rect2)
UIColor.white.setFill()
path2.fill()
}
}