我有从具有自定义单元格的数据库加载的表格视图。On button checkBox 应该出现在 table view 的每个单元格上。在此之后,我只想从表格视图中删除选中的项目。怎么可能?
问问题
148 次
2 回答
1
我猜你有一个要填充的数组。
所以你必须从数组中删除元素并像这样创建一个 reloadData
[yourTableView reloadData];
于 2012-06-04T10:11:56.217 回答
1
Here recording data array is a array of dictionary in which there is a key which keep track of which button is checked or which is unchecked. on clicking Delete button you can use below mentioned concept for deleting more than open array at a go :
USE THIS CONCEPT :
- (IBAction)deleteClicked:(id)sender
{
for(int index = 0 ; index < [recordingDataArray count] ; index++)
{
NSMutableDictionary *item = [recordingDataArray objectAtIndex:index];
BOOL checked = [[item objectForKey:@"checkStatus"] boolValue];
if(checked)
{
[recordingDataArray removeObjectAtIndex:index];
index--;
}
}
[self.recordingTblView reloadData];
}
THANKS & REGARDS,
GAUTAM TIWARI
于 2012-06-04T11:17:35.970 回答