zoukankan      html  css  js  c++  java
  • swift开发笔记09

    // 类的扩展

    public extension UIColor {

        convenience init(r: Int, g:Int, b:Int, a:CGFloat) {

            self.init(red: CGFloat(r)/255, green:CGFloat(g)/255, blue: CGFloat(b)/255, alpha: a)

            

        }

        

        convenience init(hex: Int) {

            self.init(r: (hex & 0xff0000) >> 16, g: (hex & 0xff00)  >> 8, b: (hex & 0xff), a: 1)

        }

    }

     

    // 参数,带有默认值

        init(name: String, avatarName: String = "bayMax", education: String)

        {

            self.name = name

            self.avatarName = avatarName

            self.education = education

        }

     

    // 参数的get方法

        fileprivate var user: FBMeUser {

            get {

                return FBMeUser.init(name: "BayMax", education: "CMU")

            }

        }

    //参数的初始化,cell的注册

        private let myTableView: UITableView = {

            let view = UITableView.init(frame: .zero, style: .grouped)

            view.register(CellOne.self,forCellReuseIdentifier: CellOne.indentifier)

            return view

        }()

     

        public static var color: Color{

            return Color()

        }

     

     

     

     

     

     

  • 相关阅读:
    【HDU2050】折线分割平面
    【Codevs1183】泥泞的道路
    Pair
    【Poj 1832】连环锁
    【Poj1090】Chain
    【UVa 10881】Piotr's Ants
    【Codeforces】665E Beautiful Subarrays
    【T^T】【周赛】第一周周赛——欢迎16级的新同学
    【OI新闻】2016.10.09
    二分图的最大匹配
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7340038.html
Copyright © 2011-2022 走看看