【发布时间】:2021-01-31 08:15:37
【问题描述】:
我正在尝试从响应中加载图像,但它显示“无法分配 'String 类型的值?'输入'UIImage?'”。我已经在 tableView 中加载了标签,但无法加载图像。我使用 alamofire 进行 API 调用。这是我的代码。提前致谢
extension ContactVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
arrData.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ContactCell", for: indexPath) as? ContactCell
cell?.lblEmpName.text = self.arrData[indexPath.row].name
cell?.lblEmpDesignation.text = self.arrData[indexPath.row].designation
cell?.imgEmp.image = self.arrData[indexPath.row].profilePhoto
return cell!
}
【问题讨论】:
标签: uitableview alamofireimage