先来一发

我在:


先来一发_第1张图片
IMG_5962.PNG

先贴一段遮罩页面代码:

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Monaco; color: #fcfb3f}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Monaco; color: #fcfb3f; min-height: 21.0px}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Monaco; color: #00b1ff}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Monaco; color: #4bd157}span.s1 {font-variant-ligatures: no-common-ligatures; color: #c73ddc}span.s2 {font-variant-ligatures: no-common-ligatures}span.s3 {font-variant-ligatures: no-common-ligatures; color: #ff4000}span.s4 {font-variant-ligatures: no-common-ligatures; color: #00b1ff}span.s5 {font-variant-ligatures: no-common-ligatures; color: #08fa95}span.s6 {font-variant-ligatures: no-common-ligatures; color: #fcfb3f}span.s7 {font-variant-ligatures: no-common-ligatures; color: #4bd157}

import UIKit

class MaskLayerView: UIView {

    var _maskRect: CGRect?{
        didSet{
            self.setNeedsDisplay()
        }
    }
    
    
    override func drawRect(rect: CGRect) {
        super.drawRect(rect)
        if _maskRect == nil{
            return
        }
        let context = UIGraphicsGetCurrentContext()
        CGContextClip(context);
        CGContextClearRect(context,_maskRect!);
    }
    
    /*
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func drawRect(rect: CGRect) {
        // Drawing code
    }
    */

}

你可能感兴趣的:(先来一发)