美文网首页
2018-12-17

2018-12-17

作者: 谁拿浮生伴我一世流年 | 来源:发表于2018-12-17 16:58 被阅读2次

    swift 4.0 设置 UIView 圆角

     funcsetView() ->UIView{

            let view =UIView()

            let  path:UIBezierPath=UIBezierPath.init(roundedRect: view.bounds, byRoundingCorners: [.topLeft,.topRight], cornerRadii:CGSize(width:12, height:0))

            let shapLayer:CAShapeLayer = CAShapeLayer()

            shapLayer.lineWidth=1

            shapLayer.strokeColor = UIColor.white.cgColor

            shapLayer.fillColor = UIColor.clear.cgColor

            shapLayer.path  = path.cgPath

            let maskLayer:CAShapeLayer = CAShapeLayer.init()

            maskLayer.path= path.cgPath

            view.layer.mask= maskLayer

            view.layer.addSublayer(shapLayer)

            return view

        }

    相关文章

      网友评论

          本文标题:2018-12-17

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