集成UIView

阅读更多

来源:

 

http://stackoverflow.com/a/27057168/2967461

 

 

class MyView: UIView {
    override init (frame : CGRect) {
        super.init(frame : frame)
        addBehavior()
    }

    convenience init () {
        self.init(frame:CGRect.zero)
    }

    required init(coder aDecoder: NSCoder) {
        fatalError("This class does not support NSCoding")
    }

    func addBehavior (){
        print("Add all the behavior here")
    }
}



let u = MyView(frame: CGRect.zero)
let v = MyView()

 

你可能感兴趣的:(集成UIView)