[英]can not update an image of a cell in table view
我正在為如下所示的可查看視圖定制單元
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier = @"overViewCell";
tableCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if ( tableCell == nil ) {
[[NSBundle mainBundle] loadNibNamed:@"OverViewCell" owner:self options:nil];
tableCell = overViewCell;
self.overViewCell = nil;
}
..............................................................
}
和OverViewCell.xib看起來像(正確的圖像標記為3)
然后,我想通過執行此操作從表格視圖更改特定單元格的圖像
- (void) updateImageView {
// currentRow is getting value when cellForRowAtIndex is clicked
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:currentRow inSection:0];
UITableViewCell *cell = [self.tableContent cellForRowAtIndexPath:indexPath];
imageView = (UIImageView*)[cell viewWithTag:3];
imageView.image = [UIImage imageNamed:@"checked.png"];
[self dismissViewControllerAnimated:YES completion:nil];
}
但是,圖像根本沒有改變
我在中間缺少什么...如果您對此問題有任何線索,請提供幫助。
我想出了問題所在。 這是因為我為該圖像分配了錯誤的標簽
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.