我想知道人們如何實現一個異步的UIImageView加載,如果你有它在一個自定義的UITableViewCell裏面,我已經看到很多使用GCD的子例子UIImageView ..所有這些都必須涉及NSURLRequest和NSURLConnection。那麼人們如何在UITableViewCell的子類中做到這一點,UITableViewCell中有一個UIImageView?異步UIImageView在自定義UITableViewCell
1
A
回答
0
這裏是一個很好的教程,在解釋異步加載一般....
您可以使用同樣的想法來加載圖像視圖..
0
我想簡單和理想的方式做,這是做以下步驟
- 內
cellForRowAtIndexPath:
檢查如果圖像是可用的本地加載,否則斷火NSURL請求下載一個單獨的線程並顯示加載指示圖像。 - 完成請求線程後,在本地保存圖像重新加載tableView。
1
看此類別:SDWebImage。這是一個圖像下載器UIImageView
。你把你的圖像視圖中的細胞,並在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
方法,只需使用:
[myImageView setImageWithURL:[NSURL URLWithString:@"example.com/myimage.jpg"]];
相關問題
- 1. 自定義的UITableViewCell與零的UIImageView
- 2. 自定義UITableViewCell異常
- 3. UIImageView未在自定義UITableViewCell中顯示圖像
- 4. UIImageView根本不會出現在自定義的UITableViewCell中
- 5. UIImageView沒有出現在自定義UITableViewCell中
- 6. UITableViewCell自定義
- 7. 自定義UITableViewCell
- 8. UITableViewCell自定義
- 9. 自定義UITableViewCell
- 10. 自定義UITableViewCell
- 11. 自定義UIImageView通過UITableViewCell重新對齊
- 12. 自定義的UITableViewCell的UIImageView將不會適應,直到點擊
- 13. 自定義UITableViewCell iOS
- 14. 自定義UITableViewCell UIButton
- 15. Swift - 自定義UIImageView類
- 16. UIImageView與自定義邊框
- 17. Javascript,異步,發送自定義var
- 18. 異步Google Analytics自定義變量
- 19. Oozie自定義異步操作
- 20. 自定義的UITableViewCell + resignFirstResponder
- 21. 自定義的UITableViewCell消失
- 22. 自定義UITableViewCell backgroundView和selectedBackgroundView
- 23. iOS自定義UItableviewcell部分
- 24. 自定義UITableViewCell位置
- 25. 自定義繪製UITableViewCell
- 26. 自定義UITableViewCell - 不顯示
- 27. 使用UIScrollView自定義UITableViewCell
- 28. 自定義的UITableViewCell NSUnknownKeyException
- 29. prepareForSegue出自定義UITableViewCell
- 30. 自定義UITableViewCell與按鈕
其實我想有一個適當的緩存功能 – xonegirlz