AQGridView backed by a NSFetchedResultsController

I'm trying to implement a AQGridView that uses a fetched results controller as its datasource.

I'm not particular sure how to handle the NSFetchedResultsController delegate methods using the grid view; namely the content changing ones. I understand how to use the FRC for the other grid view datasource delegates.

Could somebody point me in the right direction?

Answers


The result should look a little something like this:

- (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];
  }

}

Need Your Help

best pratice to compile all templates files in a unique file with backbone/marionette

backbone.js requirejs underscore.js marionette underscore.js-templating

I have a huge application built with Backbone, Marionette, Require.js and this is an example of the view that I'm using:

Refcusor as input to stored procedure

sql oracle oracle-sqldeveloper

Is it possible to pass refcursor as input variable to a stored procedure. Like:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.