在我的 cellForRowAtIndexPath
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
//...do cell setup etc.
UIImage *iconthumbNail = [UIImage imageNamed:@"icon.png"];
UIImageView * iconimgView = [[UIImageView alloc] initWithFrame:CGRectMake(265, 34, 25, 25)];
[iconimgView setImage:iconthumbNail];
//imgView.image = thumbNail;
[cell addSubview:iconimgView];
[iconimgView release];
// add a few more UIImageViews to the cell
}
那么在我的
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:NO];
UITableViewCell * theCell = [tableView cellForRowAtIndexPath:indexPath];
for (UIView * b in cell.subviews)
{
if ([b isKindOfClass:[UIImageView class]])
{
// how do I check that its 'iconImgView' so that I can change it?
}
}
So I add an UIImageView in my cellForRowAtIndexPath, then when that table cell is selected I want to change one of the images in the cell, 'iconImgView' but how do I identify this UIImageView from the other UIImageViews present in that cell?
非常感谢,-代码