swift 小结

1,协议

protocol UICollectionViewCartoonLayout : UICollectionViewDelegateFlowLayout {

    func collection(_ collect:UICollectionView,layout collectionLayout : UICollectionViewFlowLayout,bg_colorForSection section : Int) -> UIColor

}

2,扩展

extension UICollectionViewCartoonLayout {

    func collection(_ collect:UICollectionView,layout collectionLayout : UICollectionViewFlowLayout,bg_colorForSection section : Int) -> UIColor {

        return collect.backgroundColor ?? UIColor.clear

    }

}

3,block

public typealias ParallaxHeaderHandlerBlock = (_ parallaxHeader: ParallaxHeader)->Void

4,属性

public var minimumHeight: CGFloat = 0 {

        didSet {

            layoutContentView()

        }

    }

5,枚举

public enum HorizontalAlignment: Alignment {

    case left

    case justified

    case right

}

6,全局汇总

var kScreenWidth = UIScreen.main.bounds.width

7,懒加载

lazy var detailConentVc : RZCartoonTabDetailViewController = {

        let vc = RZCartoonTabDetailViewController()

        vc.delegate = self

        return vc

    }()

8,解决适配问题

//MARK: SnapKit

extension ConstraintView {

    /**解决iphoneX以后的底部和顶部安全距离*/

    var snap: ConstraintBasicAttributesDSL {

        if #available(iOS 11.0, *) {

            return self.safeAreaLayoutGuide.snp

        } else {

            return self.snp

        }

    }

}

9 高斯模糊

addSubview(bgView)

        bgView.snp.makeConstraints { (make) in

            make.edges.equalToSuperview()

        }

         let blurEffect = UIBlurEffect(style: .dark)

        blurView = UIVisualEffectView(effect: blurEffect)

        bgView.addSubview(blurView)

        blurView.snp.makeConstraints { (make) in

            make.edges.equalToSuperview()

        }

           bgView.addSubview(coverView)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值