2011-11-21 57 views
0

我想將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和標籤進入細胞。

在此先感謝

回答

0

你還沒有爲你的imageview設置框架,我認爲這是問題所在。因此,嘗試這種

設置爲

imageView1.frame = CGRectMake(); 

設置幀根據您的要求....

1

你應該得到所選擇的小區使用

[tableView cellForRowAtIndexPath:indexPath]; 

然後你可以在上面添加的意見

2

您需要的廣告驗證碼: -

cell = [self.tableView cellForRowAtIndexpath]; 
相關問題