正在应用渐变效果但不完全适用于图像
以下是我的代码:
let gradient = CAGradientLayer()
gradient.frame = CGRect(x: 0, y: 0, width: reportCell.reportImageView.bounds.size.width, height: reportCell.reportImageView.bounds.size.height)
gradient.colors = [UIColor.clear.cgColor,UIColor.black.cgColor]
gradient.locations = [0.0, 1.0]
reportCell.reportImageView.layer.addSublayer(gradient)
reportCell.reportImageView.image = UIImage(named: "\(indexPath.row).jpeg")