美文网首页
UIView(视图)

UIView(视图)

作者: Alan龙马 | 来源:发表于2017-05-11 17:08 被阅读17次
    lazy var bgView: UIView = {
            
            let view = UIView ()
            view.backgroundColor = UIColor.white
            
            return view
        }()
    
           bgView.snp.makeConstraints { (make) -> Void in
            make.width.equalTo(50)
            make.height.equalTo(50)
            make.center.equalTo(self.view)
           }
    

    线

           lineView.snp.makeConstraints { (make) -> Void in
            make.left.equalTo(self.contentView);
            make.right.equalTo(self.contentView);
            make.bottom.equalTo(self.descLable.top);
            make.height.equalTo(1);
           }
    

    顶部圆角

            let bgView = UIView ()
            bgView.frame = CGRect.init(x: 50, y: 80, width: 100, height: 100)
            bgView.backgroundColor = UIColor.gray
            self.view.addSubview(bgView)
            
            
            let maskPath = UIBezierPath.init(roundedRect: view.bounds, byRoundingCorners: .topLeft , cornerRadii: CGSize(width: 10, height: 10))
            let maskLayer = CAShapeLayer.init()
            maskLayer.frame = view.bounds
            maskLayer.path = maskPath.cgPath
            bgView.layer.mask = maskLayer
    

    相关文章

      网友评论

          本文标题:UIView(视图)

          本文链接:https://www.haomeiwen.com/subject/xvaotxtx.html