先来一发

我在:


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
    }
    */

}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 176,235评论 25 709
  • 一直想写点儿东西,记录睿宝儿的成长足迹, 这5年来,很多重要时刻、好玩、让我感慨的瞬间, 懒于没有用文字记录下来,...
    flowla阅读 2,118评论 1 2
  • 男孩和女孩相遇在一次花展。其实在之前他已经注意到她了。在公交204上,男孩目光不自觉望着坐在一侧的一个女孩,她低头...
    心花4ever阅读 1,950评论 0 0
  • 感恩早上的晨曦 夜晚的星月 春夏秋冬的轮回 鸟语花香的熏陶 自然界的灵性 感恩有多少 爱就有多少 爱有多少 幸福就...
    快乐灵芝阅读 2,778评论 16 23

友情链接更多精彩内容