Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在按钮中设置(TableView cellForRowAtIndexpath)活动?_Iphone_Ios_Ios6_Ios4 - Fatal编程技术网

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

Iphone 如何在按钮中设置(TableView cellForRowAtIndexpath)活动?,iphone,ios,ios6,ios4,Iphone,Ios,Ios6,Ios4,嘿,伙计们,请让我知道如何将此代码操作设置为UIButton操作。。。 代码如下: -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSString *myIdentiFier=@"myIdentiFier"; myCell *cell=[tableView dequeueReusableCellWithIdentifier:myIde

嘿,伙计们,请让我知道如何将此代码操作设置为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 {
}
请告诉我……你可以打电话

[tableview reloadData]

然后调用cellforrowatinexpath

简单地说,你可以这样做

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

你到底在看什么for@Bhupesh无论我的tableview方法在做什么,我都希望它应该通过按钮操作来完成。是否要在tableview中添加新单元格?为此,您需要在数据源中插入新条目,即案例中的
content
数组。完成后,请调用
[tableView reloadData]
。请详细说明。。请看这个示例:检查您的tableView框架未显示。。单击..后显示消失的数据:(取消对此行单元格的注释=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:myIdentiFier];是否添加委托和数据源?检查此链接“”