场景:
我有一个@IBOutlet weak var posterImageView: UIImageView!,我使用Kingfisher在我的tableView上展示它(我必须使用它)。该图片来自API。所以没问题,图片显示正常,但我想将这个图片显示为圆形。我在没有使用Kingfisher时实现了它,使用以下代码:
posterImageView.layer.cornedRadius = posterImageView.frame.size.width/2
posterImageView.clipsToBounds = true
但是使用翠鸟库,我正在这样做:
let imgStg: String = self.movies[indexPath.row].poster!
let imgURL: URL? = URL(string: imgStg)
let imgSrc = ImageResource(downloadURL: imgURL!, cacheKey: imgStg)
cell.posterImageView.kf.setImage(with: imgSrc)
在这个函数内部:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
当我在viewDidLoad()中调用posterImageView.layer.cornedRadius时,Xcode提示在TableViewController中找不到posterImageView。
我该如何使用这个Kingfisher调用来自定义我的图像视图?