iphone - Sort TableView cells with AlertView in XCode 4 -


I added the "Sort" button in the navigation bar to sort the tableview. Tableview is made in this way:

  - (zero) viewDidoadload {[Super Viewedload]; NSString * myfile = [[NSBundle main bundle] pathForResource: @ "object" type: @ "plist"]; Sorted object = [[NSMUTABELARROL] INNTH WITH CONTENT OFFFILE: MIMEFIELD]; NSSortDescriptor * sortDesc = [[NSSortDescriptor alloc] initWithKey: @ "Popularity" ascending: Yes]; [Sort Object Object Sorting Descriptors: [NSARRAARIJject: SortDesk]]; [Super viewedload]; }   

This is the function for the sequence button:

  - (IBAction) Sort button: (ID) sender; {UIAlertView alloc] initWithTitle: @ "Sort" message: @ "" Representative: Cancel selfTuttonite: @ "Cancel" otherbittnittals: @ "name", @ "country", @ "popularity", @ Zero] ; [Alerts show]; [Warning issued]; }   

and this button has the delegate method to capture the click:

  - (zero) alertview: (UIAlertView *) AlertViews clicked Button atindex: ( NSINTGer) Button Index {if (buttonIndex == 0} {// Sort name} else if (buttonIndex == 1) {// Sort by country} and if (button index == 2) {// according to popularity Sort}}   

How do I apply the SortDescriptor method in ClickedButtonAtIndex, and update TableView?

I want to solve TableView with popularity by default.

Plist structure (array of dictionaries):

  plist version = "1.0" & gt; Array & gt; Dict & gt; Key & gt; Country / Key & gt; String & gt; Italy / String & gt; Key & gt; Name / Key & gt; String & gt; Fuzzo / String & gt; Key & gt; Popularity / Key & gt; Integer & gt; 1 / integer & gt; / Dict & gt; Dict & gt; Key & gt; Country / Key & gt; String & gt; Span / String & gt; Key & gt; Name / Key & gt; String & gt; Alamos Malbeck / String & gt; Key & gt; Popularity / Key & gt; Integer & gt; 2 / integer & gt; / Dict & gt; / Array & gt; / Plist & gt;   

To display it was to delete the beginning of the html code .. it looks like a mess, so I think someone knows how it will decide for me

  - (zero) warning view: (UIAlertView *) Alertview clicked Button atindex: (Nsyntiger) buttonindex {nssortdiscriptor * sortdesk; Switch (Button Index) {Case 0: Return; break; Case 1: SortDesk = [[NSSSort Descriptor Alok] Init WithKey: @ "Names" Climb: Yes]; break; Case 2: SortDesk = [[NSSSort Descriptor Alok] Init Withs: @ "Country" Climbing: Yes]; break; Case 3: SortDesk = [NSW Descriptor Sort Descriptors Withheets: @ "Popularity" Ascending: No Compiler: ^ (ID OGJ1, ID OGJ2) {Return [OBJ1 Comparison: Ozzje 2 Option: NSNumeric Search]; }]; break; } [Sorted object sorting descriptors: [NSARRAARIJject: SortDesk]]; [Self.tableViewReloadData]; }    

Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -