在我的项目中,我使用UICollectionView显示图标网格。
用户可以通过单击分段控件来更改顺序,该分段控件调用具有不同NSSortDescriptor的核心数据的访存。
数据量始终相同,只是结束于不同的部分/行:
- (IBAction)sortSegmentedControlChanged:(id)sender {
   _fetchedResultsController = nil;
   _fetchedResultsController = [self newFetchResultsControllerForSort];
   NSError *error;
   if (![self.fetchedResultsController performFetch:&error]) {
       NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
   }
   [self.collectionView reloadData];
}
问题在于reloadData不会使更改生效,UICollectionView只会弹出新数据。
我应该跟踪更改前后一个单元格在哪个indexPath中,并使用[self.collectionView moveItemAtIndexPath:toIndexPath:]来执行更改动画,或者是否有更好的方法?
我对继承collectionViews没有太多的兴趣,所以任何帮助都将是很大的...
谢谢,比尔。
reloadData调用包装在动画块中?