How can I add shadow to a circle UIImageView or UIView?

前端 未结 6 2045
迷失自我
迷失自我 2020-12-25 13:31

I am trying to make a circle UIImageView, and it works. Below is the way I use to make it:

[self.pic.layer setMasksToBounds:YES];
[self.pic.laye         


        
6条回答
  •  眼角桃花
    2020-12-25 13:52

    extension UIImageView {
        func addShadow() {
            self.layer.shadowColor = UIColor.black.cgColor
            self.layer.shadowOffset = CGSize(width: 2, height: 5)
            self.layer.shadowOpacity = 0.5
            self.layer.shadowRadius = 1.0
            self.clipsToBounds = false
        }
    }
    try this code. hope it will help you....
    

提交回复
热议问题