UIView初始化程序swift

UIView初始化程序swift

本文介绍了UIView初始化程序swift Xcode 6 beta 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

xcode 6 beta 5

xcode 6 beta 5

错误:

Class'ClassName'未实现其超类的必需成员

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

    class ClassName:UIView

还显示错误

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

重写声明所需的 'ovveride' 关键字

Overriding declaration required an 'ovveride' keyword

我在init之前放置了覆盖,删除了ovveride错误但是超类错误不是

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

提前感谢

推荐答案

Xcode6 beta5 -init(编码器:) 已成为被覆盖的必需方法:

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

}

这篇关于UIView初始化程序swift Xcode 6 beta 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 14:30