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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:29:44+00:00 2026-06-04T14:29:44+00:00

In my app, I have a UITableView that is populated by Core Data, currently

  • 0

In my app, I have a UITableView that is populated by Core Data, currently a string called “name.” I want to be able to divide this tableview into 3 sections, which could be named 0, 1 and 2, or 1, 2 and 3. The name doesn’t really matter. I currently really don’t know how to achieve this. I have a new attribute in my data model called “term” which is what I want the sections to be based off of. Is it best for this to be an integer?

I’m kind of a newbie at iOS development, so if anyone knows how do this, I would greatly appreciate it .

Here’s my current code that sorts that populates the tableview with the “name” attribute.

- (void)setupFetchedResultsController
{
    //1 - Entity
    NSString *entityName = @"Task"; // Put your entity name here
    NSLog(@"Setting up a Fetched Results Controller for the Entity named %@", entityName);

    //2 Request
    NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:entityName];

    // 3 - Filter
    //request.predicate = [NSPredicate predicateWithFormat:@"Task.name = name"];

    // 4 - Sort
    request.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"name"
}

Thanks everyone!

  • 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-04T14:29:45+00:00Added an answer on June 4, 2026 at 2:29 pm

    I don’t understand if you use a NSFetchedResultsController or not.

    In the first case (you use it) you can take advantage of it setting term as the attribute for dividing in section. When you create a NSFetchedResultsController with – initWithFetchRequest:managedObjectContext:sectionNameKeyPath:cacheName: you can pass@"term" as a parameter for sectionNameKeyPath.

    In the second case, I really suggest to deal with a NSFetchedResultsControllers when dealing with UITableViews. Setting up a NSFetchedResultsController is really sample since you need to create it and pass it a NSFetchRequest. The one you created is ok.

    For further info I suggest to read core-data-tutorial-how-to-use-nsfetchedresultscontroller and also NSFetchedResultsController class reference.

    Hope it helps.

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

Sidebar

Related Questions

I have two very simple, identical UITableViews in my app that are populated with
I have an app that uses a UITableView to list documents which are stored
I have an app, where there's one UIWebView and a UITableView. I don't want
I have a Core Data based application that stores hierarchal data displayed using a
In my app I have a UITableView that contains custom UITableViewCells. Scrolling is very
Let's say I have a UITableView that is part of an iPad app doesn't
I have a UITableView which is populated with some parsed JSON twitter data. The
I have a app that will populate a UITableView after the user takes a
I have a UITableView that I populate with data that i download over the
I have a UITableView that I want to scroll down and up without touching

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.