zoukankan      html  css  js  c++  java
  • IOS自定义样式

    
    extension UIView{
        //圆角
        @IBInspectable public
        var cornerRadius: CGFloat {
            get {
                return layer.cornerRadius
            }
            set {
                layer.cornerRadius = newValue
            }
        }
        //阴影圆角
        @IBInspectable public
        var shadowRadius: CGFloat {
            get {
                return layer.shadowRadius
            }
            set {
                layer.shadowRadius = newValue
            }
        }
        //透明度
        @IBInspectable public
        var shadowOpacity: Float {
            get {
                return layer.shadowOpacity
            }
            set {
                layer.shadowOpacity = newValue
            }
        }
        //阴影颜色
        @IBInspectable public
        var shadowColor: UIColor? {
            get {
                return layer.shadowColor != nil ? UIColor(cgColor: layer.shadowColor!) : nil
            }
            set {
                layer.shadowColor = newValue?.cgColor
            }
        }
        //阴影偏移
        @IBInspectable public
        var shadowOffset:CGSize{
            get{
                return layer.shadowOffset
            }
            set{
                layer.shadowOffset = newValue
            }
        }
    }```
    保存为UIViewHelper.swift
  • 相关阅读:
    Python with
    Python else
    Python list
    The Python Debugger Pdb
    RPM 包
    yum
    OpenStack I18N
    Python unittest
    MySQL 行格式
    MySQL 行溢出数据
  • 原文地址:https://www.cnblogs.com/exlo/p/13884449.html
Copyright © 2011-2022 走看看