如何在A按钮中设置(TableView cellForRowAtIndexpath)活动?

问题描述:

嗨,请让我知道我可以设置在此代码行动的UIButton的行动...... 下面是代码:如何在A按钮中设置(TableView cellForRowAtIndexpath)活动?

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

NSString *[email protected]"myIdentiFier"; 

myCell *cell=[tableView dequeueReusableCellWithIdentifier:myIdentiFier]; 

if(!cell){ 
    //cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:myIdentiFier]; 
    NSArray *nib=[[NSBundle mainBundle]loadNibNamed:@"myCell" owner:self options:nil]; 
    for(id obj in nib){ 
     if([obj isKindOfClass:[myCell class]]){ 
      cell=(myCell *)obj; 
      break; 
     } 
    } 
} 

NSDictionary *diction=(NSDictionary*)[content objectAtIndex:indexPath.row]; 
[cell.contentView setBackgroundColor:[UIColor orangeColor]]; 

cell.empID.text=[diction objectForKey:@"empid"]; 
cell.empName.text=[diction objectForKey:@"empname"]; 
cell.designation.text=[diction objectForKey:@"empdesignation"]; 
cell.teamName.text=[diction objectForKey:@"empteam"]; 

return cell; 

} 

我想在我的按钮设置上述动作..

- (IBAction)displayRecord:(id)sender { 
} 

请告诉我...

+0

究竟你正在寻找 – Bhupesh

+0

@Bhupesh不管我的tableview方法是做我想,它应该通过按钮动作完成.. – Deep

+0

你要添加新的细胞在表格视图中?为此,您需要在数据源中插入新条目,即您的案例中的“内容”数组。一旦完成,调用'[tableView reloadData]'。 – Amar

你可以叫

[tableview reloadData] 

比cellForRowAtIndexPath被调用。

+0

请详细说明..我nd得到 – Deep

+0

看看这个例子:http://www.aboveground.com/tutorials/adding-a-uitableview-to-a-custom-uiview – Birdy

只是ü可以做如下

- (IBAction)displayRecord:(id)sender { 
      [yourTablename reloadData]; 
} 
+0

如果有查询请求 –

+0

检查你的tableView框架 –

+0

不显示..点击后显示消失的数据.. :( – Deep