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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:40:35+00:00 2026-05-24T02:40:35+00:00

Using Core Data, I have my fetchedResultsController with a with a date field. I

  • 0

Using Core Data, I have my fetchedResultsController with a with a date field.

I want to display two sections according to the date: if it’s a date in the future I want to display it in the section active, otherwise in the non Active section.

Besides I want between the two sections I want to display a “draft section”.

It is also important to mention that inside each section, I want them sorted by date.

1) Can I still use the fetchedResultsController? or will I need to create 3 different arrays?

2) Does the field used on sectionNameKeyPath need to be a String?

Edit:

3) Can I set the order of my sections other than alphabetically?

Edit 2:

for 3) Sections are not ordered alphabetically. How to fix the order of the sections if they’re in no way related to the NSSortDescriptor I set to my fetchRequest?
Thanks in advance.

  • 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-05-24T02:40:37+00:00Added an answer on May 24, 2026 at 2:40 am

    If you are using custom objects for your NSManagedObjects then all you really need to do is define a method that returns which section it should be in. Not sure what you mean by draft section but as long as the NSManagedObject subclass has a method that generates “Draft” then you should be fine.

    To sort by date within a section simply add the sort descriptor to the fetch request. Simple as that.

    I’ve done a similar thing in one of my Apps so if you have any other questions do ask.

    You also want to look at subclassing NSFetchedResultsController if you want to customize the creation of sections and index titles. It’s all in the docs.

    For part 3) there are a couple of ways

    1. Make your class return names in the display order e.g. @”1)Past” @”2)Present” @”3)Future” and then override the controller:sectionIndexTitleForSectionName: to strip off the 1) 2) etc.
    2. There is no need to use the default section ordering, you could do a lookup so that when the table asks for section 1 you return the results from section 2 etc.

    1 Might seem a bit more kludgy but is probably what I would try first.

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

Sidebar

Related Questions

I have an application using Core Data and bindings. I want to have an
I'm using core data in my app. I have two entities that are related:
I have two NSTableViews populated with Core Data that are linked using bindings. When
I am using Core Data and want a Text Label to display how many
I am creating an iOS 5 app using Core Data. I have two entities
I have just started using core data. I want to setup a pre-populated db.
I have the following setup using Core Data: Nib1: A WindowController with two custom
I'm using core data and I have a simple two-entity model. My navigation controller
Hi I have created an array from core-data using: NSArray* invoiceItem =[fetchedResultsController fetchedObjects]; which
im developing application for ios5.im using core data as data storage.i have to display

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.