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

  • Home
  • SEARCH
  • 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 8990855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:35:42+00:00 2026-06-15T22:35:42+00:00

Actually i’m using only one section . I sort my data stored in core

  • 0

Actually i’m using only one section. I sort my data stored in core data by date.

I want to have two sections (latest and history). In my first section “latest” I want to put my latest date and in the other section “history” i want to put other dates sorted by date.

My table is editable and I’m using NSFetchedResultsController.

Here is my sample code for numberOfRowsInSection:

 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc]init];
    [fetchRequest setEntity:[NSEntityDescription entityForName:@"Info"
                                    inManagedObjectContext:self.managedObjectContext]];

    // Define how we want our entities to be sorted
    NSSortDescriptor* sortDescriptor = [[[NSSortDescriptor alloc]
                                    initWithKey:@"date" ascending:NO] autorelease];
    NSArray* sortDescriptors = [[[NSArray alloc] initWithObjects:sortDescriptor, nil] autorelease];

    [fetchRequest setSortDescriptors:sortDescriptors];

    NSString *lower = [mxData.name lowercaseString];
    NSPredicate *predicate = [NSPredicate predicateWithFormat: @"(name = %@)", lower];

    [fetchRequest setPredicate:predicate];

    NSError *errorTotal = nil;
    NSArray *results = [self.managedObjectContext executeFetchRequest:fetchRequest error:&errorTotal];

    if (errorTotal) {
        NSLog(@"fetch board error. error:%@", errorTotal);
    }

    return [results count];

    [fetchRequest release];
    [results release];
}
  • 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-15T22:35:44+00:00Added an answer on June 15, 2026 at 10:35 pm

    You need to modify your designated “UITableViewDataSource” object to return “2” for the “numberOfSectionsInTableView:“ method.

    Then you need to return the right thing in your “tableView:cellForRowAtIndexPath:“ method, depending on the section designated in the index path.

    If you want an optional section title (e.g. “History” or “Latest”), you can also return an array of section titles via sectionIndexTitlesForTableView:.

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

Sidebar

Related Questions

Actually i want that, suppose i have a colorcode #FF3366. How can i examine
Actually i have used following two methods for image resize but my client says
Actually I have an application that is using a WebService to retrieve some clients
Actually i use references to reference two external dlls for my project. I want
Actually I donot have flash in my computer.So I want to see the swf
Actually i fed a datatable by a List. I want to display in one
Actually i have deployed two ears test.ear and test1.ear on jboss 5.x server. test.ear
Actually I want user to select two years and then I want to fetch
Actually, I'm using this way. Do you have a better way? private bool AcceptJson(HttpRequest
Actually, this question seems to have two parts: How to implement pattern matching? How

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.