swift - 使用 KingFisher 时不显示图像
问题描述
我不确定为什么会发生这种情况,但我之前使用过相同的代码,我从 firebase 存储下载的图像没有显示为按钮背景。我已经打印出 url,它正在获取 url,所以我不确定为什么图像没有显示。setUpView 函数在 viewdidload 中被调用,我也试过 viewwillappear
private func setUpView(){
self.setNavigationBarLogo()
if User.currentUser() != nil {
let currentUser = User.currentUser()!
print(currentUser.profileImage)
if let url = URL(string: currentUser.profileImage) {
print("-----\(url)----")
self.profileImageBtn.kf.setBackgroundImage(with: url, for: .normal)
self.profileImageBtn.setTitle("", for: .normal)
}
}
}
解决方案
推荐阅读
- javascript - 使用javascript从页面加载asp.net C#后面的代码添加css类
- spring-webflux - 如何将阻塞代码转换为反应代码
- lwjgl - 全屏闪烁:LWJGL
- facebook-chatbot - Chatfuel 没有清除用户输入缓存
- php - joomla 到 wordpress 迁移和 404 错误问题
- javascript - 带有多个文件的Javascript附加表单
- powershell - Powershell 未从 CMD(批处理)脚本执行
- emscripten - 如何在 emsripten C++ 中启用 webGL 2.0 API 库?
- android - 从android中的代码向布局添加视图的最佳方法是什么?
- html - 元素摆动 CSS