我已经尝试了几乎所有内容,但是完全不知道如何在图像视图上同时获得圆角和阴影。这就是我目前所拥有的,它只会有圆角或阴影,而不会同时有两者。
Exporter::import
也尝试过:
class ImageRoundedCorner: UIImageView {
override func awakeFromNib() {
super.awakeFromNib()
self.clipsToBounds = false
self.layer.shadowColor = UIColor.black.cgColor
self.layer.shadowOpacity = 1
self.layer.shadowOffset = CGSize.zero
self.layer.shadowRadius = 10
self.layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: 10).cgPath
let image = UIView(frame: self.bounds)
self.clipsToBounds = true
self.layer.cornerRadius = 7
self.addSubview(image)
}
}