class SwiftyRecordButton: SwiftyCamButton {
private var circleBorder: CALayer!
private var innerCircle: UIView!
override init(frame: CGRect) {
super.init(frame: frame)
drawButton()
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
drawButton()
}
private func drawButton() {
self.backgroundColor = UIColor.white
circleBorder = CALayer()
circleBorder.backgroundColor = UIColor.red.cgColor
circleBorder.borderWidth = 6.0
circleBorder.borderColor = UIColor.blue.cgColor
circleBorder.bounds = self.bounds
circleBorder.position = CGPoint(x: self.bounds.midX, y: self.bounds.midY)
circleBorder.cornerRadius = self.frame.size.width / 2
layer.insertSublayer(circleBorder, at: 0)
}
}
我在渲染此按钮时遇到问题。这是一个特殊的按钮,我用来代替来自swifty cams库的标准按钮。问题来自drawButton函数。即使我清楚地称之为它,我也看不到带有边框的Snapchat样式按钮。谁能看到我哪里出错?