Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/118.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
Ios Xcode未在表单元格上使用NSMutableArray_Ios_Xcode_Uitableview_Cocoa Touch_Cell - Fatal编程技术网

Ios Xcode未在表单元格上使用NSMutableArray

Ios Xcode未在表单元格上使用NSMutableArray,ios,xcode,uitableview,cocoa-touch,cell,Ios,Xcode,Uitableview,Cocoa Touch,Cell,我正在构建一个使用表单元格的iPhone应用程序。我将此代码设置为尝试从表中删除单元格,但它似乎不起作用,因为我没有使用NSMutableArray。当我刷卡时,我得到了删除按钮,但删除按钮没有任何作用。我的问题是,如果我没有在我的表单元格中使用NSMutableArray,那么可以使用这一行:[self.dataArray removeObjectAtIndex:indexPath.row]工作 使用的代码 (BOOL)tableView:(UITableView *)tableView ca

我正在构建一个使用表单元格的iPhone应用程序。我将此代码设置为尝试从表中删除单元格,但它似乎不起作用,因为我没有使用NSMutableArray。当我刷卡时,我得到了删除按钮,但删除按钮没有任何作用。我的问题是,如果我没有在我的表单元格中使用NSMutableArray,那么可以使用这一行:
[self.dataArray removeObjectAtIndex:indexPath.row]工作

使用的代码

(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    return YES; }
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        //remove the deleted object from your data source.
        //If your data source is an NSMutableArray, do this
        [self.dataArray removeObjectAtIndex:indexPath.row];
    } }

以下是apple doc的表视图编程指南的链接。它有一个简单的委托方法,使用
NSArray
,并有一个示例代码可用于删除和插入。上面显示的代码缺少执行删除操作的代理部分。看看清单7.3,这可能就是您想要的