0
Firebaseレスポンスに画像URLが設定されているセルのカスタムUITableViewCell内にUIImageViewを表示しています。コード以下のように:私は、もし条件if (imageURL == "NIL")
画像が正しく表示されますが、私は戻ってスクロールすると、イメージはそれが現れてはならない場所を表示し始め削除する場合UITableViewCellのUIImageViewが条件として表示されない
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cellIdentfier = "ArticleTableViewCell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentfier, forIndexPath: indexPath) as!ArticleTableViewCell
//Configure the cell
// Added by ankit khanna for UIImageView change
let imageURL = imageArray[indexPath.row]
print ("Final Image URL: [\(imageURL)]")
if (imageURL == "NIL") {
cell.articalImageView.hidden = true
}
let fileUrl = NSURL(string: imageURL as String)
print ("File URL : [\(fileUrl!)]")
cell.articalImageView.hnk_setImageFromURL(fileUrl!)
// End
}
問題があります。
画像アレイ:以下var imageArray = [String]()
は、私は、私はそれが空である応答のためのUIImageViewを無効にするとしていますどのように配列
if (snapshot.value.objectForKey("image") != nil)
{
let url = snapshot.value.objectForKey("image")!
let f_url = String(url)
// print ("image1 URL : \(f_url)")
self.imageArray.append(f_url)
}
else if (snapshot.value.objectForKey("image") == nil)
{
self.imageArray.append("NIL")
}
を付加していたコードです。