Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.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 表数据重新加载问题_Iphone_Tableview_Reload - Fatal编程技术网

Iphone 表数据重新加载问题

Iphone 表数据重新加载问题,iphone,tableview,reload,Iphone,Tableview,Reload,请参阅下面的代码,它将从数组中删除对象,但不会重新加载表 - (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@" commitEditingStyle"); if (editingStyle == UITableVie

请参阅下面的代码,它将从数组中删除对象,但不会重新加载表

- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
forRowAtIndexPath:(NSIndexPath *)indexPath 
{
    NSLog(@" commitEditingStyle");
    if (editingStyle == UITableViewCellEditingStyleDelete) 
    {
        NSLog(@" commitEditingStyle Delete ");
        [self.arry removeObjectAtIndex:indexPath.row];
        [tableView reloadData];
    } else if (editingStyle == UITableViewCellEditingStyleInsert)
    {
        NSLog(@" commitEditingStyle Insert ");
        [self.arry insertObject:@"New Row" atIndex:[arry count]];
        [tableView reloadData];
    }
}  
此外,我还有
[tableView reloadData]
视图中写入的
将出现
&
视图加载
,但它不会重新加载

TableView
通过故事板添加到ViewController,IBoutlet添加到
.h
文件

- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
ForRowatineXpath:(NSIndexPath*)indexPath{

if (editingStyle == UITableViewCellEditingStyleDelete) {
    [arryData removeObjectAtIndex:indexPath.row];
    [tblSimpleTable reloadData];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
    [arryData insertObject:@"Mac Mini" atIndex:[arryData count]];
    [tblSimpleTable reloadData];
}
}


使用类似的方法

您必须将消息发送到您的出口(如果您有一个出口,即
self.tableView
),或者直接发送到调用委托方法的tableView:
[aTableView reloadData](注意a

如果仔细查看方法签名,您将看到tableView实例作为
aTableView
传递给您:


-(void)tableView:(UITableView*)
或tableView..

从何处获取self.arry数据?您在哪里添加数据?您必须将消息发送到您的出口(如果您有一个出口,即
self.tableView
),或直接发送到调用委托方法的tableView:
[aTableView reloadData](注意
a
)您选中了“插入”和“删除”这两个选项都不起作用???对于insert
[self.arry insertObject:@“新行”索引:[arry count]+1]@iPatel:两者都不起作用在ViewWillAspect方法中创建NSMutableArray