iphone: why my in-app purchase product array object index set automatically in alphabetical order

I am working on in-app purchase task in app I done all work currently but I need one help that my product array display in UITableview with sorting in alphabetical but I need display as same a my productIdentifiers how can I do this stuff please help

My issue example below:-

I set my product productIdentifiers like

- (id)init 
{
   NSSet *productIdentifiers = [NSSet setWithObjects:
                                   @"com.myapp.calculation.c",
                                   @"com.myapp.calculation.d",
                                   @"com.myapp.calculation.a",
                                   @"com.myapp.calculation.s",
                                   @"com.myapp.calculation.b",
                                   @"com.myapp.calculation.h",
                                   nil];

    if ((self = [super initWithProductIdentifiers:productIdentifiers])) 
    {                

    }

    return self;
}   

and in tableview data display on cell alphabetical sorting with a b c d h s

but i need it display as same as productIdentifiers like c d a s b h

Please help.

Answers


Expanding on Adam's comment above, if you are trying to display data from a collection class in a table view, you should use an array as the data source, not a set. This is because the objects contained within an NSArray are automatically ordered, based on how the objects are placed into the array, and so will come out in that order. With an NSSet the contents are unordered and thus will come out in any order.

Take a look at Apple's Values and Collections document, which gives details of the three main types of collection class available in Cocoa: NSArray, NSSet and NSDictionary.


Need Your Help

Extracting regions from a Scala Array

algorithm scala functional-programming partitioning

I don't really know how to describe what I'm doing, but this example should help:

WPF Dictionary using DataTemplates on a DataTemplateSelector always having a null value for the key

c# wpf dictionary

I have a dictionary on my DataTemplateSelector that holds a list of datatemplates. The constructor creates the dictionary holding DataTemplate properties as the value but the dictionary is always

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.