C&C++   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了objective-c – 由NSFetchedResultsController支持的AQGridView大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图实现一个使用获取的结果控制器作为其数据源的AQGridView.

我不太确定如何使用网格视图来处理NSFetchedResultsController委托方法;即内容变化.我了解如何将FRC用于其他网格视图数据源代理.

有人可以指出我的方向正确吗?

解决方法

结果应该看起来有点像这样:
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
  [gridView beginupdates];
}

- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo
       aTindex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeTypE)type
{
  switch(typE)
  {
    case NSFetchedResultsChangeInsert:
      break; 
    case NSFetchedResultsChangedelete:
      break;
  }
}

- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
   aTindexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeTypE)type
  newIndexPath:(NSIndexPath *)newIndexPath
{

  ChAnnelPageViewController *currentPageController,*desTinationPageController;

  NSIndexSet * inDices = [[NSIndexSet alloc] initWithIndex: indexPath.row];
  NSIndexSet *newInDices = [[NSIndexSet alloc] initWithIndex:newIndexPath.row];

  switch(typE) {
      case NSFetchedResultsChangeInsert:
        [gridView insertItemsATinDices:newInDices withAnimation:AQGridViewItemAnimationNone];
      break;

      case NSFetchedResultsChangedelete:
        [gridView deleteItemsATinDices:inDices withAnimation:AQGridViewItemAnimationNone];
        break;

      case NSFetchedResultsChangeupdate:
        [gridView reloadItemsATinDices:inDices withAnimation:AQGridViewItemAnimationNone];
        break;

      case NSFetchedResultsChangeMove:
        [gridView deleteItemsATinDices:inDices withAnimation:AQGridViewItemAnimationNone];
        [gridView insertItemsATinDices:newInDices withAnimation:AQGridViewItemAnimationNone];
        break;
   }
}

- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller
{
  [gridView endupdates];
  if ([[frc fetchedObjects] count] == 1) {
    [gridView reloadData];
  }

}

大佬总结

以上是大佬教程为你收集整理的objective-c – 由NSFetchedResultsController支持的AQGridView全部内容,希望文章能够帮你解决objective-c – 由NSFetchedResultsController支持的AQGridView所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。