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 8995949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:41:16+00:00 2026-06-15T23:41:16+00:00

I have fairly large amount of data which I would like to partition into

  • 0

I have fairly large amount of data which I would like to partition into the custom sections, for sections based on some keypath and some other sections on some other conditions. So I came up with idea to subclass NSFetchedResultsController. This subclass of NSFetchedResultsController should provide the flexibility of returning the sections in its method -(NSArray*)sections which returns an array of id<NSFetchedResultsSectionInfo>. If I could implement by own class that conforms to the protocol and then pass the custom array of the objects in sections method of fetchedResultsController, I think I could accomplish my task.

Is there a way to implement NSFetchedResultsSectionInfo in your own class and then return the custom array of such object in the fetchedResultsController subclass? Or is there some library to accomplish this?

Edit

Let me describe what I am trying to achieve. I have Contacts model as NSManagedObject subclass. This entity has a attribute called state which can be unknown, known and unidentified. Now, I want these contacts to be sectioned in such a way that all the unknown contact appear in a single section, also the unidentified contacts should be in another different section. Now, all other known contacts should be in the different sections according to the name of contact. How can this be done ?

My table view should be populated as;

Unknown Contacts (sorted into a single section according to date )
  - 
  -
Known Contacts(A)(known contacts sorted into different sections according to the name)
  -
  -
Known Contacts(B)
  -
  -
  -
Known Contacts(C)
  -
  -
  -
  -
  -
  -
Known Contacts(Z)
 -
UnIdentified Contacts(sorted into a single section with first name)
  -
  -
  -
  • 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-15T23:41:17+00:00Added an answer on June 15, 2026 at 11:41 pm

    NSFetchedResultsController already implements this.

    NSArray* sectionsArray = self.fetchedResultsController.sections;
    

    To implement the special sections follow the principles in the Apple sample code DateSectionTitles. The pattern is as follows:

    • Create a new transient attribute sectionIdentifier. Like in the sample code, also include the primitiveSectionIdentifier attribute in your managed object subclass. This is the attribute that you use for sectionNameKeyPath in your FRC.

    • Devise a scheme that sorts correctly. Put all the sorting and computing logic into the class implementation file’s custom getter for sectionIdentifier. For example you could simply use two characters that sort before the capital letter “A” which presumably would be the first of your regular section headers. You could also make it into a number, say 1 and 2 for your first two sections, and 3+ for the first letters in the alphabet.

    • Decode your scheme in titleForHeaderInSection to display the desired content.

    I recently did this for a client who had a non-standard coding scheme for a large list of contacts indicating some marketing segmentation. The data for the section identifier was also pulled from several different attributes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have compared two queries which fetch some fairly large data from a database
I have a fairly large amount of data (~30G, split into ~100 files) I'd
I have a fairly large C++ application (on Windows, no other platforms planned), which
I have a fairly large SQL statement which has a number of inner joins
I have fairly large script within an .svg file and I'd like to get
I have method in my web service which loads the same mySQL data into
I have a fairly large .txt file ~9gb and I will like to load
I have a fairly large map consisting of Raphael paths which im trying to
I have fairly large set of data returned via AJAX from a page. This
I have a fairly large set of Core Data entities with a date property.

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.