Ios 按钮不渲染
我对这个按钮的渲染有问题。这是一个特殊的按钮,我用它来代替来自迅捷cams库的标准按钮。这个问题与drawButton功能有关。尽管我明确地称之为snapchat,但我看不到应有边框的snapchat样式按钮。有人知道我哪里出错了吗?在索引10处插入层有什么意义?应该是零正确吗?输入错误很抱歉,应用程序运行时您看到了什么?普通按钮?你的代码应该work@Sergey没有什么Ios 按钮不渲染,ios,swift,swiftycam,Ios,Swift,Swiftycam,我对这个按钮的渲染有问题。这是一个特殊的按钮,我用它来代替来自迅捷cams库的标准按钮。这个问题与drawButton功能有关。尽管我明确地称之为snapchat,但我看不到应有边框的snapchat样式按钮。有人知道我哪里出错了吗?在索引10处插入层有什么意义?应该是零正确吗?输入错误很抱歉,应用程序运行时您看到了什么?普通按钮?你的代码应该work@Sergey没有什么 class SwiftyRecordButton: SwiftyCamButton { private var
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)
}
}