Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.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
Objective c UITableViewCell删除上的签名_Objective C_Ios_Uitableview - Fatal编程技术网

Objective c UITableViewCell删除上的签名

Objective c UITableViewCell删除上的签名,objective-c,ios,uitableview,Objective C,Ios,Uitableview,我试图使用苹果提供的“编辑”->(-->“删除”功能从我的UITableView中删除一行 我在这里激活了按钮: - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.rightBarButtonItem = self.editButtonItem; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPat

我试图使用苹果提供的“编辑”->(-->“删除”功能从我的UITableView中删除一行

我在这里激活了按钮:

- (void)viewDidLoad {
    [super viewDidLoad];

    self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    PositionCell *cell = (PositionCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[PositionCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }

    FSExAppDelegate *appDelegate = (FSExAppDelegate *)[[UIApplication sharedApplication] delegate];
    Position *pos = [appDelegate.positions objectAtIndex:indexPath.row];

    [cell setPosition:pos];

    // Configure the cell.

    return cell;
}
在此处创建的UITableViewCell:

- (void)viewDidLoad {
    [super viewDidLoad];

    self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    PositionCell *cell = (PositionCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[PositionCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }

    FSExAppDelegate *appDelegate = (FSExAppDelegate *)[[UIApplication sharedApplication] delegate];
    Position *pos = [appDelegate.positions objectAtIndex:indexPath.row];

    [cell setPosition:pos];

    // Configure the cell.

    return cell;
}
然后就是苹果提供的代码:

// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source.
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }   
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
    }   
}
当我执行删除操作时,我被困在:

    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
使用“线程1:程序接收信号‘SIGABRT’”

我一直在这里搜寻问题,但似乎找不到关于这个问题的任何东西。有人能帮忙吗


DJ。

我想你漏掉了:

[mutableArrayAsDataSource removeObjectAtIndex:[indexPath row]];
这可能发生在deleteRowsAtIndexPaths调用之前

[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
请把这个换成下面的

[tableView deleteRowsAtIndexPaths:[urArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];