2011-12-02 69 views
-1

我创建了一个应用程序,其中如果我选择表视图中的特定行比选定的行将展开(我已经实现行onclick行完全扩展,但我有问题[cell.contentview addsubview:]请参阅图像我有提供)&有一些按钮,但我不能在表视图中获得完美的视图没有点击行我可以看到其他单元格的按钮here is image!如何添加按钮cell.contentview不工作完美?

我的代码显示按钮在这里。

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 


     static NSString *CellIdentifier = @"Cell"; 

     cell = [tableBusiness dequeueReusableCellWithIdentifier:CellIdentifier]; 
     if (cell == nil) { 

      //cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; 
      cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; 
     } 
     //cell.textLabel.borderStyle = UITextBorderStyleNone; 
     cell.textLabel.text = [NSString stringWithFormat:@"%d",indexPath.row]; 

     UILabel *theText = [[UILabel alloc] initWithFrame:CGRectMake(10.0,10.0, 200, 22.0)]; 
     theText.text = [NSString stringWithFormat:@" Title Text %d",indexPath.row]; 
     [cell.contentView addSubview:theText]; 

     btnMenu = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
     btnMenu.frame = CGRectMake(80, 160, 100, 37); 
     [btnMenu setTitle:@"Go to Menu" forState:UIControlStateNormal]; 
     [btnMenu addTarget:nil action:@selector(accessoryTypeForRowWithIndexPath:) forControlEvents:UIControlEventTouchUpInside]; 
     [cell.contentView addSubview:btnMenu]; 
     //textView.text = nil;  

     return cell; 
     [btnMenu release]; 

     [theText release]; 

} 

&我要让按钮事件像点击特定按钮打开,当点击按钮的产品怎么办? 没有任何解决方案,请帮助我。 i want to create like this !Here is description for the image thread.

here its link for how to expand row.?

+0

这真的很恶心......如果有人不能给出答案,那么请告诉我为什么你投了我的问题。你已经完美地阅读了我的问题。有没有人看到我提供的所有有用的数据来解释你?任何人都可以告诉我这里怎么了? –

回答

0

如果你想增加细胞的高度,然后ü可以用下面的代码

UITableView *movieListTbl; 
movieListTbl.rowHeight = "Height of cell"; 

尝试,但要记住,你委托你的tableview。

+0

我想你没有明白我的观点。请阅读我的问题,我已经实现了行增加,但我想知道我的答案cell.content查看请参阅我提供的图像。这里这个标签是图片! –