switf重载

import UIKit

import Foundation

class MyView: UIView {

 //   var acolor :UIColor

    

    /*

    // Only override draw() if you perform custom drawing.

    // An empty implementation adversely affects performance during animation.

    override func draw(_ rect: CGRect) {

        // Drawing code

    }

    */

//    private var cancelButtonTitle: String!;

//    private var destructiveButtonTitle: String!;

//    private var otherButtonTitles: [String]!;

//

    

    override init(frame: CGRect) {

//        cancelButtonTitle = String()

//        destructiveButtonTitle = String()

//        otherButtonTitles=[String]()

        super.init(frame:frame)

    }

    

    required init?(coder aDecoder: NSCoder) {

        super.init(coder: aDecoder)!;

    }

        //convenience可选够造初始

    convenience init(acolor:UIColor) {

       self.init(frame: CGRect.zero)

//        self.cancelButtonTitle = cancelButtonTitle;

//        self.destructiveButtonTitle = destructiveButtonTitle;

//        self.otherButtonTitles = otherButtonTitles;

        self.backgroundColor = acolor

       // prepareUI();

    }

    

}

一天一章
原文地址:https://www.cnblogs.com/hangman/p/8403813.html