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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:08:51+00:00 2026-06-03T22:08:51+00:00

I have a custom plist file which contains dictionaries. Each dictionary contains information about

  • 0

I have a custom plist file which contains dictionaries. Each dictionary contains information about one car:

     <key>Ford</key>
<dict>
    <key>name</key>
    <string>Ford</string>
    <key>color</key>
    <string>green</string>
    <key>price</key>
    <integer>45000</integer>
</dict

    <key>Toyota</key>
<dict>
    <key>name</key>
    <string>Toyota</string>
    <key>color</key>
    <string>blue</string>
    <key>price</key>
    <integer>40000</integer>
</dict

    <key>BMW</key>
<dict>
    <key>name</key>
    <string>BMW</string>
    <key>color</key>
    <string>blue</string>
    <key>price</key>
    <integer>40000</integer>
</dict>

I also have an UITableView and I fill it with some cars from this plist.

 NSEnumerator *enumerator = [dictionary objectEnumerator];
    id returnValue;


    while ((returnValue = [enumerator nextObject])) 
    {

        if ([[returnValue valueForKey:@"color"]isEqualToString:@"blue")
        {  
            [array addObject:[returnValue valueForKey:@"name"]];
        }

Question: When I get an UITableView with some cars in it, how can I sort them by price now? For example, BMW is cheaper than Ford, so it should be in the first cell and Ford must be in a second cell. I know that Apple has already created easy ways to sort arrays but how can I use it here ? Thanks !
Max

  • 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-03T22:08:53+00:00Added an answer on June 3, 2026 at 10:08 pm

    Try with this:

    NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"price"  ascending:YES];
    [array sortUsingDescriptors:[NSArray arrayWithObjects:descriptor,nil]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tableview which contains custom cells where each cell has some PDF
i have added a custom font - one which i have downloaded from from
I have a custom listview which changes size when one of the rows is
In my application i have an custom NSObject, which contains 2 mutable Arrays. I
I have custom UITableViewCell . It contains UITextLabel . When I press this cell
I have custom gallery. Gallery represents items that are frame layout. There are one
I have custom component that I can place in my layout file (XML) for
I have custom UITableViewCell s as well as headers and footers. Each of them
I have a multi-target iPhone app which currently includes a header file with constant
I have a class called XYZ inheriting from NSObject and an array which contains

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.