Reputation: 8058
My image exists in as tableView Cell so I am using the following code to make changes to it: (I am updating image from cache if there is any confusion below)
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'
}
what do I do?
Upvotes: 1
Views: 232
Reputation: 7013
Type casting is a must here
if let nimage:UIImageView = cell.viewWithTag(111) as! UIImageView{ // 111 is a UIImageView
nimage.image = imageCache[urlString]
}
Upvotes: 2