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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:26:52+00:00 2026-05-29T13:26:52+00:00

i want to sort my Data in my Tableview. I have UIButtons with IBAction

  • 0

i want to sort my Data in my Tableview. I have UIButtons with IBAction to call the sort.
I have created a string which contains the sortKey. I am setting the the key and call the fetchedResultsController again, to sort the tableview.

Problem is, fetchedResultsController method is not called and the sorting doesnt work.
here is my code:

- (IBAction) actionSortCardColor:(id) sender {
    XLog(@"");
    sortString = @"colorOrder";
    [self fetchedResultsController];

    [self actionRemoveSortView:sender];
}    

Here my fetchedResultsController method:

- (NSFetchedResultsController *)fetchedResultsController
{

[...]


NSPredicate *inboxPred = [NSPredicate predicateWithFormat:@"archived == 0"];

// Set the batch size to a suitable number.
[fetchRequest setFetchBatchSize:20];
[fetchRequest setPredicate:inboxPred];

XLog(@"sortString: %@", sortString);
if (sortString == nil) {
    sortString = [[NSString alloc] initWithString:@"sortingOrder"];
}

NSSortDescriptor *sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"setTitle" ascending:YES] autorelease];
NSSortDescriptor *sortDescriptor2 = [[[NSSortDescriptor alloc] initWithKey:sortString ascending:YES] autorelease];
NSArray *sortDescriptors = [[[NSArray alloc] initWithObjects:sortDescriptor, sortDescriptor2, nil] autorelease];

[fetchRequest setSortDescriptors:sortDescriptors];

[...]
}  
  • 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-29T13:26:52+00:00Added an answer on May 29, 2026 at 1:26 pm

    Where is it that you let the table view know about these changes? You’ll need to reload the data for your table view instance [tableView reloadData];

    When you set the __fetchedResultsController to nil, it cannot update the UITable view with any changes because it isn’t in scope.

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

Sidebar

Related Questions

I have AutoFilter in place in my sheet. I want to sort data using
I have a HashMap<String, Integer> How can I sort this data structure and keep
Hello i have this XML and i want to sort all the MESSAGE/DATA/TRANSACTIONS/TRANSACTION With
I have an input file that I want to sort based on timestamp which
I want to sort a data table on base of occurrence of string like
I have core data entity: mole, which I display in a TableView. When I
I want to sort a String that has nr. How do I do that?
I want to sort a list of strings based on the string length. I
I have a custom data structure that I want to display in a PyQt
I have an array with arrays in it, where I want to sort the

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.