我正在尝试更改表格视图中的图片。我正在使用[myTableView reloadData];
另一种方法(即启动)来刷新我的TableView
,我可以看到 tableview 中的其他元素正在刷新,但图像保持不变。我错过了什么?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
UILabel *lblName;
UIImageView *checkMark = [[UIImageView alloc] initWithFrame:CGRectMake(230, 0, 30, 50)];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectMake(10, 1, 260, 70)];
backgroundView.backgroundColor = UIColorFromRGB(0x000000, 0.3);
backgroundView.userInteractionEnabled = YES;
checkMark.image = [UIImage imageNamed:@"V.png"];
checkMark.contentMode = UIViewContentModeCenter;
checkMark.backgroundColor = [UIColor clearColor];
[backgroundView addSubview:checkMark];
[checkMark release];
[cell.contentView addSubview:backgroundView];
[backgroundView release];
}
if (something)
{
checkMark.image = [UIImage imageNamed:@"halfleft.png"];
NSLog(@"something was done");
}
return cell;
}