具体的UITableViewCell我有一个tableview中,我想一个imageview的增加它在选择在该行的单元格的内容查看。addSubview对选择
这是我当前的代码,当我点击任一单元格它只会将imageView添加到最后一行,而不是我点击的那一行。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
playIcon = [[UIImageView alloc]initWithFrame:CGRectMake(20, 22, 9, 12)];
UIImage *image = [UIImage imageNamed: @"cell_play.png"];
[playIcon setImage:image];
[cell.contentView addSubview:playIcon];
}
你没有表现cell'如何'声明/初始化。我会NSLog它,以确保它是有效的...最好使用' - (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath'。 – smparkes 2012-01-27 21:36:00