2017-01-27 5 views
0

Nuke 4.1.2を使用して、UITableViewのセルイメージにイメージをダウンロードして設定しています。iOS Nuke、loadImageをアクティビティインジケータの補完とともに使用する方法

これは正常ですが、動作インジケータはありません。

if let url = URL(string: imageUrl) {     
    Nuke.loadImage(with: url, into: cell.itemImage) 
} 

これを試してみると、以下のエラーが表示されます。

cell.activityIndicator.startAnimating() 

if let url = URL(string: imageUrl) {         
    Nuke.loadImage(with: url, into: cell.itemImage) { [weak cell.itemImage] in 
    cell.itemImage.handle(response: $0, isFromMemoryCache: $1) 
    cell.activityIndicator.stopAnimating()  
} 

エラー:

fields may only be captured by assigning to a specific name 

答えて

0
cell.activityIndicator.startAnimating() 

let cellImageView = cell.imageView 

Nuke.loadImage(with: url, into: cellImageView) { [weak cellImageView] in 
cellImageView?.handle(response: $0, isFromMemoryCache: $1) 

cell.activityIndicator.stopAnimating() 
関連する問題