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

时间:2013-05-30 12:44:49

标签: iphone ios ios6 ios4

嘿伙计们,请让我知道如何将此代码操作设置为UIButton操作... 这是代码:

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

NSString *myIdentiFier=@"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 {
}
请告诉我......

2 个答案:

答案 0 :(得分:0)

你可以打电话

[tableview reloadData]

比调用cellForRowAtIndexPath。

答案 1 :(得分:0)

你可以按照以下方式做到

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