Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9187357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:44:54+00:00 2026-06-17T19:44:54+00:00

I am using a UICollectionView with core data and NSFetchedResultsController. When a cell is

  • 0

I am using a UICollectionView with core data and NSFetchedResultsController.

When a cell is selected I want to move it into a different section at the top of the collection view. The problem is that the section might not have been added yet. I basically need to add a new section when a cell is selected before I move the cell into the new section.

See below –

enter image description here

Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:44:55+00:00Added an answer on June 17, 2026 at 7:44 pm

    It looks as if you are going about this in the wrong way. If I were you I would try to delete the object and then reinsert it with the correct section key.

    So, if your NSManagedObject has a section-key of 1 you will need to store the objects values locally whilst you delete the object. Then you can create a new record with the stored values and update the section-key to 0.

    This should remove the old cell and insert a new one in a new section.

    See below –

    - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
    {
        NSManagedObject *obj = [_fetchedResultsController objectAtIndexPath:indexPath];
    
        NSString *name = obj.name;
    
        [self.managedObjectContext deleteObject:task];
    
        NSError *error = nil;
        [self.managedObjectContext save:&error];
    
        NSManagedObject *newObj = [NSEntityDescription insertNewObjectForEntityForName:@"entityName" inManagedObjectContext:self.managedObjectContext];
    
    
        [newObj setValue:name forKey:@"name"];
    
        [self.managedObjectContext newObj];
    
        error = nil;
        [self.managedObjectContext save:&error];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got this UICollectionView set up with a fetched results controller, using core data.
I am using UICollectionView to generate several thumbnails in a Master View. This works
I want to delete multiple items from my HomeDirectory. I'm using UICollectionView with allowsMultipleSeletion
I am new to using UICollectionView. I have created a footer section in the
I recently added a UICollectionView to my storyboard, it's currently pushed into view by
My collection view cell structure is described as below For cellItemAtIndex , I do
I'm using UICollectionView to show grid based View in iPad. I have only 200
I'm using a UICollectionView with two prototype cells. The prototype cells have different widths
I want to show images in a grid on iPhone using a UICollectionView, showing
Using a populated Table Type as the source for a TSQL-Merge. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.