在我UITableViewCells我需要下載不同的圖像的每個細胞,我應該爲這樣那樣的問題,做...不想使用dequeueReusableCellWithIdentifier爲UITableViewCell的
0
A
回答
2
您還是應該使用該方法,然後獨立配置每個單元。只要確保你的設置是不是你的建築塊
UITableViewCell *cell = [tableView dequeue..];
if (!cell) {
cell = ...;
}
cell.image = ...;
+0
謝謝,它的工作 – Shoaib
0
項目將您的圖像
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"]];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
NSDictionary *item = (NSDictionary *)[self.content objectAtIndex:indexPath.row];
cell.textLabel.text = [item objectForKey:@"mainTitleKey"];
cell.detailTextLabel.text = [item objectForKey:@"secondaryTitleKey"];
NSString *path = [[NSBundle mainBundle] pathForResource:[item objectForKey:@"imageKey"] ofType:@"png"];
UIImage *theImage = [UIImage imageWithContentsOfFile:path];
cell.imageView.image = theImage;
return cell;
}
相關問題
- 1. UITableViewCell dequeueReusableCellWithIdentifier不按順序
- 2. 問題與dequeueReusableCellWithIdentifier,自定義UITableViewCell
- 3. 避免dequeueReusableCellWithIdentifier以防止UITableViewCell凍結
- 4. dequeueReusableCellWithIdentifier不起作用
- 5. 是否dequeueReusableCellWithIdentifier:在我的UITableViewCell子類中調用初始化器?
- 6. segue不能與UITableViewCell alloc一起工作,但dequeueReusableCellWithIdentifier
- 7. 爲什麼在「dequeueReusableCellWithIdentifier」中使用「viewWithTag」?
- 8. UITableView使用dequeueReusableCellWithIdentifier還是不行?
- 9. dequeueReusableCellWithIdentifier不重複使用細胞
- 10. UITableViewCell在排隊時保存視圖嗎? (用於dequeueReusableCellWithIdentifier)
- 11. dequeueReusableCellWithIdentifier永不返回
- 12. UITableViewCell使用reuseidentifier給出不想要的結果與回調塊
- 13. iPhone - dequeueReusableCellWithIdentifier用法
- 14. tableView dequeueReusableCellWithIdentifier
- 15. dequeueReusableCellWithIdentifier forIndexPath
- 16. UITableViewCell中的UISegmentedControl在通過dequeueReusableCellWithIdentifier重用時更改段索引順序
- 17. 不想將內容置於UITableViewCell上
- 18. dequeueReusableCellWithIdentifier不釋放數據
- 19. dequeueReusableCellWithIdentifier不返回細胞
- 20. 使用UITableViewCell作爲tableHeaderView
- 21. dequeueReusableCellWithIdentifier不適用於ARC和IOS 4
- 22. 使用dequeueReusableCellWithIdentifier時無法顯示detailTextLabel
- 23. 如何在Swift中使用dequeueReusableCellWithIdentifier?
- 24. dequeueReusableCellWithIdentifier UITableView的兩次
- 25. 的UITableViewCell爲textLabel不是iphone
- 26. 爲什麼使用dequeueReusableCellWithIdentifier時框架總是相同? (Cocoa Touch)
- 27. dequeueReusableCellWithIdentifier錯誤
- 28. 獲取無dequeueReusableCellWithIdentifier
- 29. 關於dequeueReusableCellWithIdentifier:
- 30. dequeueReusableCellWithIdentifier:細胞
從那裏ü要加載圖像的字典? – Rose