【问题标题】:Default Image Isn't Displaying When Setting Image设置图像时不显示默认图像
【发布时间】:2019-06-13 21:31:01
【问题描述】:

我正在尝试将默认头像图像设置为“忍者”图像。但是,此代码未显示默认图像。不知道出了什么问题。

        ProfileService.showOtherUser(user: bet.sentToUser) { [weak self] (profile2) in
              self?.profile2 = profile2
              if (profile2?.imageURL == "") {
                  cell.userImage.image = UIImage(named: "ninja")
              }else{
                  let imageURL = URL(string: ((profile2?.imageURL ?? "")))
                  cell.userImage.kf.setImage(with: imageURL)
              }
           }
        }

【问题讨论】:

  • 检查文件名是否匹配正确(区分大小写)。另外,在主线程上执行。
  • 文件名匹配

标签: swift database image default placeholder


【解决方案1】:

以这种方式将您的图像放在情节提要中的图像视图中,直到您不以编程方式更改它,它将保持默认设置

【讨论】:

    猜你喜欢
    • 2013-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-23
    • 2022-10-16
    • 2023-03-06
    相关资源
    最近更新 更多