Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 按钮不渲染_Ios_Swift_Swiftycam - Fatal编程技术网

Ios 按钮不渲染

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

我对这个按钮的渲染有问题。这是一个特殊的按钮,我用它来代替来自迅捷cams库的标准按钮。这个问题与drawButton功能有关。尽管我明确地称之为snapchat,但我看不到应有边框的snapchat样式按钮。有人知道我哪里出错了吗?

在索引10处插入层有什么意义?应该是零正确吗?输入错误很抱歉,应用程序运行时您看到了什么?普通按钮?你的代码应该work@Sergey没有什么
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)
    }
}