我是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];
}
}
Run Code Online (Sandbox Code Playgroud)
为什么NSIndexSet代表这里的部分?另外,在这个例子sectionIndex中只是一个数字,它是否NSIndexSet只有一个数字?如果只有一个数字,为什么不用a int代表呢?
谢谢.