2011-04-07 32 views
1

我设置了单元格的默认图标后,我想将默认图标更改为小截图。屏幕截图我从一台服务器上逐渐变成了一台服务器,我正在从这些服务器上创建UIImage。 我的问题是,我不知道如何改变具体细胞中的accessoryView。在桌面视图中逐个更改accessoryView

我从代码周期是在这里:

// after I got a bytmap with the screenshot 
UIImage *imageCopy = [ImageHelper convertBitmapRGBA8ToUIImage:newBitmap withWidth:width withHeight:height]; 
UIImageView *imageView = [[UIImageView alloc] initWithImage:imageCopy]; 
UITableViewCell *myCell = [self.tableView cellForRowAtIndexPath:(NSIndexPath *) i]; 
myCell.accessoryView = imageView; 
[imageView release]; 

问题是,我认为,随着行:

UITableViewCell *myCell = [self.tableView cellForRowAtIndexPath:(NSIndexPath *) i]; 

回答

0

你必须刷新表更改后:

[self.tableView reloadData] 

如果它仍然没有改变图像,那么在你的分配中有一个问题。

+0

应用在符合问题 – gbaor 2011-04-07 11:47:25

+0

崩溃是你我一个int?你不能投一个int到NSIndexPath – 2011-04-07 11:55:09

+0

NSLog NSIndexPath和MyCell的值。它看起来像一个不好的参考/零问题。 – 2011-04-07 11:56:28

0

在你的情况下,我会写一个UITableViewCell的子类,它将URL保存到你的截图中。然后,当他们下载时,您可以拨打UITableView的metod visibleCells,它返回可见单元格的数组。比较图像来自的url和你的单元格的子类的url属性,你可以为单元格设置合适的accesoryView

0

问题与该行解决:

UITableViewCell *myCell = [self.tableView cellForRowAtIndexPath: [NSIndexPath indexPathForRow:0 inSection:1] ]; 

感谢名单的用户:inovaction

+0

然后接受他的答案,而不是张贴自己的? – Kalle 2011-04-07 20:13:12