我想从数组中删除一个对象,当我的表视图获取reload
,从tableview中显示的数组中删除对象时,我正在使用– removeObjectAtIndex:
从数组中删除对象。 请帮我从数组永久删除对象。提前感谢。如何从iphone中的数组中删除一个对象
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[myArray removeObjectAtIndex:indexPath.row];
[tableView reloadData];
}
}
添加一些代码... – Bhavin 2013-03-22 12:39:03
你是否重新加载你的tableview之前或之后,你从数组中删除对象? – tttthomasssss 2013-03-22 12:39:23
'removeObjectAtIndex'应该可以工作。你确定你要发送正确的索引吗?数组中的第一项是C中的索引0,与某些语言不同。 – GeneralMike 2013-03-22 12:40:21