-(void) TableView: (UITableView *) TableView Commiteditingstyle: (uitableviewcelleditingstyle) Editingstyle Forrowatindexpath: (Nsindexpath *) Indexpath {
if (Editingstyle = = uitableviewcelleditingstyledelete) {
[MyArray RemoveObjectAtIndex:indexPath.row];
[TableView Deleterowsatindexpaths:[nsarray Arraywithobject:indexpath] Withrowanimation:uitableviewrowanimatio Nfade];
}
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 VI ew.
}
}
here MyArray is an array is a data member and I've alloc, but when I'm sweeping through the simulator, I always get an error in the Remove, and this is the wrong
2011-06-08 16:51:56.989 view[749:207]-[__nsarrayi removeobjectatindex:]: Unrecognized selector sent to instance 0x4e4b530
2011-06-08 16:51:56.991 view[749:207] * * * terminating app due to uncaught exception ' Nsinvalidargumentexception ', rea Son: '-[__nsarrayi Removeobjectatindex:]: Unrecognized selector sent to instance 0x4e4b530 '
Call stack at first throw:
Workaround:
The array should initialize the called Nsmutablearray I define it as Nsarray.
NSMutablearray * myarray = [[NSMutableArray alloc] init];
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
About the UITableView sweep removal problem [Nsmutablearray Removeobjectatindex]