美文网首页
iOS Swift 圆角阴影效果参考代码

iOS Swift 圆角阴影效果参考代码

作者: 红色小星 | 来源:发表于2020-01-07 15:57 被阅读0次
    Simulator Screen Shot - iPhone 11 Pro Max - 2020-01-07 at 15.54.28.png

    iOS Swift 圆角阴影效果

     let yellowView = UIView.init(frame: CGRect(x: 30, y: 100, width: 200, height: 200))
            view.addSubview(yellowView)
            yellowView.backgroundColor = UIColor.yellow
            // 阴影不透明度
            yellowView.layer.shadowOpacity = 1.0
            // 阴影颜色
            yellowView.layer.shadowColor = UIColor.red.cgColor
            // 阴影的半径
            yellowView.layer.shadowRadius = 20.0
            // 阴影偏移量:正数向右 向下,负数向左向上
            yellowView.layer.shadowOffset = CGSize(width: 0, height: 0)
            // 圆角半径
            yellowView.layer.cornerRadius = yellowView.bounds.width / 2
    

    相关文章

      网友评论

          本文标题:iOS Swift 圆角阴影效果参考代码

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