UIView initializer swift Xcode 6 beta 5 [duplicate]

这一生的挚爱 提交于 2019-12-21 20:57:19

问题


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


回答1:


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)
        // ...
    }

}


来源:https://stackoverflow.com/questions/25160942/uiview-initializer-swift-xcode-6-beta-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!