我是 iOS 开发的新手,所以这个问题很愚蠢,但我确实很难弄清楚以下代码是如何工作的:
-(void)controller:(NSFetchedResultsController *)controller didChangeSection:(id<NSFetchedResultsSectionInfo>)sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type{
if (type==NSFetchedResultsChangeDelete) {
[self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationAutomatic];
}
}
为什么NSIndexSet
在这里表示部分?另外,在这个例子sectionIndex
中只是一个数字,它是不是NSIndexSet
只有一个数字的集合?如果它只有一个数字,为什么不直接用 aint
来表示呢?
谢谢。