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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:49:33+00:00 2026-05-28T18:49:33+00:00

First,I got some products from IAP -(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { [productDetailsList addObjectsFromArray: response.products];

  • 0

First,I got some products from IAP

-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response  
{  
    [productDetailsList addObjectsFromArray: response.products];  
    [productDisplayTableView reloadData];  
}

How to put them in a uitableview sort by product price? thank you.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath  
{  
    static NSString *GenericTableIdentifier = @"GenericTableIdentifier";  
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: GenericTableIdentifier];  
    if (cell == nil) {  
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                       reuseIdentifier:GenericTableIdentifier] autorelease];
    }   

    SKProduct *thisProduct = [productDetailsList objectAtIndex:row];
    NSUInteger row = [indexPath row];

    [button setTitle:localizedMoneyString forState:UIControlStateNormal];

    [cell.contentView addSubview:button];

    return cell; 
}
  • 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-28T18:49:34+00:00Added an answer on May 28, 2026 at 6:49 pm

    What you want to do is sort the NSArray prior to trying to read it. There are many options for sorting NSArray, most of them involve creating your own sorting method. You do something like:

    [productDetailList sortedArrayUsingFunction:intSort context:NULL];
    

    That will use your comparator method that you specify. The comparison method is used to compare two elements at a time and should return NSOrderedAscending if the first element is smaller than the second, NSOrderedDescending if the first element is larger than the second, and NSOrderedSame if the elements are equal. Each time the comparison function is called, it’s passed context as its third argument. This allows the comparison to be based on some outside parameter, such as whether character sorting is case-sensitive or case-insensitive, but this doesn’t matter in your case. The function you have to implement would look like this:

    NSInteger intSort(id num1, id num2, void *context)
    

    For more information of the above method take a look at the documentation, it give you an example.

    So you can sort the array like this or you always have the choice of sorting the array every time you add something. So every time you add an object you do the sorting yourself and make sure to put it in the right location to keep the array always sorted.

    Depending on what you want, I would say keeping the array constantly sorted on insertion time is the best option, so you don’t have to waste time while building the view by sorting the array. To do it like this would be simple, every time you enter something into the array, you iterate through the array until you find an object with a price larger than the one you want to enter, then you insert the object at the location before that entry.

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

Sidebar

Related Questions

I've got some strange bug: when I open page first time in some browser
I've got some trouble with jQuery script on my Asp.net page. During first load
I just got my ssl certificate to work for the first time. For some
I got a page of Products. Some products have multiple images (colors). I want
First of all: I wish you all Merry Christmas :) I've got some problem
I have asked a similar question here and got some answers, so first of
I've got some perfectly lovely C99 codes that are compiled from multiple .c files,
I first got an error usign the code below, explaining that DataGridLinkButton' must be
We just got our first major Perl CGI assignment in my CS class. Our
I just got my first Android device, I love it... I also love 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.