在didSelectRowAtIndexPath + uiTableview上添加uiimageview和uilabel

问题描述:

我想将uiimageview和uilabel添加到选定的行中。 现在,当我在表中选择该行,然后在didSelectRowAtIndexPath + uiTableview上添加uiimageview和uilabel

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    // Deselect cell 
    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 

> tableView deselectRowAtIndexPath:indexPath animated:TRUE]; 

     if (indexPath.row == 0) { 
      imageView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AboutImage.png"]]; 
      imageView1.center = CGPointMake(310, 48); 
      [cell.contentView addSubview:imageView1]; 
      [imageView1 release]; 

      imageView2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AboutImage.png"]]; 
      imageView2.center = CGPointMake(310, 48); 
      [cell.contentView addSubview:imageView2]; 
      [imageView2 release]; 

但后来也这样做了ImageView的是没有出现以后。 请谁能帮助me..How添加的UIImageView和标签进入细胞。

在此先感谢

你还没有为你的imageview设置框架,我认为这是问题所在。因此,尝试这种

设置为

imageView1.frame = CGRectMake(); 

设置帧根据您的要求....

你应该得到所选择的小区使用

[tableView cellForRowAtIndexPath:indexPath]; 

然后你可以在上面添加的意见

您需要的广告验证码: -

cell = [self.tableView cellForRowAtIndexpath];