【问题标题】:Why am I getting the error Value of type 'UIImageView' has no member 'sd_setShowActivityIndicatorView'为什么我收到错误“UIImageView”类型的值没有成员“sd_setShowActivityIndi​​catorView”
【发布时间】:2021-05-27 19:40:41
【问题描述】:

我试图在使用 SDWebImage 库下载我的图像时显示加载器。 The wiki page 说应该这样做:

imageView.sd_setShowActivityIndicatorView(true)

但是当我把它放在我的代码中时:

cell.firstImageView.sd_setShowActivityIndicatorView(true)

我得到错误:

Value of type 'UIImageView' has no member 'sd_setShowActivityIndicatorView'

我已经检查了 pod 文件是否使用pod SDWebImage 正确安装,并且我知道它正在工作,因为当我调用 sd_set_Image() 时我的图像会加载

【问题讨论】:

    标签: swift google-cloud-firestore sdwebimage


    【解决方案1】:

    Swift 5 从 pod SDWebImage 中删除了 sd_setShowActivityIndicatorView,但我们可以改用 sd_imageIndicator。所以,例如:

    cell.firstImageView.sd_imageIndicator = SDWebImageActivityIndicator.gray
    
    cell.firstImageView.sd_setImage(with: URL(string: urlString), placeholderImage: UIImage(named: "loading"))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-03-11
      • 1970-01-01
      • 1970-01-01
      • 2020-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多