如何使用UIImageView resizableImage添加阴影

时间:2018-06-11 09:10:30

标签: ios swift uiimageview

如何使用resizableImageView enter image description here

添加阴影
imgViewBubble.image = bubbleImage.resizableImage(withCapInsets:
            UIEdgeInsetsMake(17, 21, 17, 21),resizingMode: .stretch).withRenderingMode(.alwaysTemplate)

1 个答案:

答案 0 :(得分:1)

imgViewBubble.clipsToBounds = false 
imgViewBubble.layer.shadowColor = UIColor.black.cgColor
imgViewBubble.layer.shadowOffset = CGSize(width: 0, height: 0)
imgViewBubble.layer.shadowOpacity = 0.5
imgViewBubble.layer.shadowRadius = 5