UIView initializer swift Xcode 6 beta 5 [duplicate

2019-04-13 00:50发布

This question already has an answer here:

xcode 6 beta 5

Error:

Class 'ClassName' does not implement its superclass's required members

on

    class ClassName:UIView

also showing an error

on

        init(frame: CGRect) {
            super.init(frame: frame)
            // Initialization code
            self.backgroundColor = UIColor.clearColor()
        }

Overriding declaration required an 'ovveride' keyword

I placed override before init, ovveride error was remove but superclass error was not

thanks in advance

标签: ios swift xcode6
1条回答
Emotional °昔
2楼-- · 2019-04-13 01:19

in Xcode6 beta5 the -init(coder:) has became a required method to be overridden:

 class ClassName: UIView {

    required init(coder aDecoder: NSCoder!) {
        super.init(coder: aDecoder)
        // ...
    }

    //

    override init(frame: CGRect) {
        super.init(frame: frame)
        // ...
    }

}
查看更多
登录 后发表回答