0
我從SOAP響應作爲IMAGE_PATH顯示圖像如何從ImagePath的在swift3
(self.posts.value(forKey: 「IMAGE_PATH」)作爲[字符串])[indexPath.row]
這是我的迴應
我不能轉換這個回答我的網址,我想在我的tableViewCell
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
print((self.posts.value(forKey: "image_path") as! [String])[indexPath.row])
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! AlllLocationTableViewCell
let urlString = (self.posts.value(forKey: "image_path") as! [String])[indexPath.row] as String
print("\(urlString)")
let fileUrl = NSURL(fileURLWithPath: (self.posts.value(forKey: "image_path") as! [String])[indexPath.row])
print(fileUrl as Any)
let data = try? Data(contentsOf: fileUrl) //make sure your image in this url does exist, otherwise unwrap in a if let check/try-catch
self.Responseimage = UIImage(data: data!)!
cell.LocationImage?.image = LocationImagView1
return cell as UITableViewCell
}
是否要顯示來自URL或ImagePath的圖像? –
@JagatDave從imagePath因爲我有肥皂的路徑 – ViralRathod
導入SDWebImage庫...然後嘗試我的答案。希望它對你有所幫助。 –