![](/img/trans.png)
[英]Swift / Array of Images in UIImage only last Image is displayed multiple times
[英]Changing image displayed in UIImage Swift
我的图像以tableView Cell的形式存在,因此我正在使用以下代码对其进行更改:(如果下面有任何混淆,我将从缓存中更新图像)
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'
}
我该怎么办?
这里必须进行类型转换
if let nimage:UIImageView = cell.viewWithTag(111) as! UIImageView{ // 111 is a UIImageView
nimage.image = imageCache[urlString]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.