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()

        }

     

     

     

     

     

     

  • 相关阅读:
    djinn:1 Vulnhub Walkthrough
    面试题:HTTP协议工作原理
    面试题:URI和URL的区别
    面试题:http和https的区别?什么是http无状态协议?什么是本地存储?
    Vue+Element 踩坑记录
    面试题:Vue的生命周期
    面试题:组件封装
    面试题:vuex
    面试题:callback
    面试题---华为机试在线训练:字符串最后一个单词的长度
  • 原文地址:https://www.cnblogs.com/dengchaojie/p/7340038.html
Copyright © 2011-2022 走看看