2015-07-03 12 views
1

作爲的tableView細胞我的圖像存在於所以我用下面的代碼來進行更改:(我更新從超高速緩存的圖像,如果有下面的任何混淆)更改圖像顯示在UIImage的夫特

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 

    if let nimage = cell.viewWithTag(111){ // 111 is a UIImageView 

     nimage.image = imageCache[urlString] 

     // above error - nimage has no member named image 

     nimage = imageCache[urlString] 

     // above error - cannot assign to 'let' value 'UIImage' 

    } 

我該怎麼辦?

+0

你必須嘗試image.image因爲你說,111是一個ImageView的 –

+0

對不起,應該說'nimage.image'見上編輯 –

+0

仍然收到錯誤'nimage沒有成員名爲image' –

回答

2

型鑄造是在這裏必須

if let nimage:UIImageView = cell.viewWithTag(111) as! UIImageView{ // 111 is a UIImageView 
     nimage.image = imageCache[urlString] 
} 
相關問題