简体   繁体   English

无法在表格视图中更新单元格的图像

[英]can not update an image of a cell in table view

I am doing customized cell for uitable view like below 我正在为如下所示的可查看视图定制单元

- (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;
    }
    ..............................................................
}

and OverViewCell.xib looks like ( the right image is tagged as 3 ) 和OverViewCell.xib看起来像(正确的图像标记为3)

在此处输入图片说明

And later, I would like to change the image of particular cell from the table view by doing this 然后,我想通过执行此操作从表格视图更改特定单元格的图像

- (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];

}

However, the image is not changed at all 但是,图像根本没有改变

What I am missing in the middle... Please help if you have any clues about this issue. 我在中间缺少什么...如果您对此问题有任何线索,请提供帮助。

I figured what the problem is. 我想出了问题所在。 it is because I was assigning the wrong tag to that image 这是因为我为该图像分配了错误的标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM