objective c - NSSortDescriptor Not Working to Organize TableView -


i working on sorting tableview cells , not working reason. had earlier revision of exact same code , exact same plist have sworn worked several months. refuses sort.

sorting code inside numberofrowsinsection method:

nsstring *date = [self.months objectatindex:sectionnumber]; nsdictionary *monthdata = [self.sportdictionary objectforkey:date]; nssortdescriptor *sortdescriptor2 = [[nssortdescriptor alloc] initwithkey: nil ascending: yes]; nsarray *days = (nsarray *)[[monthdata allkeys]sortedarrayusingdescriptors:[nsarray arraywithobject:sortdescriptor2]]; for(int x = 0; x < [days count]; x++) { nslog(@"day: %@", [days objectatindex:x]); } 

when @ output of nslog, not right. getting 15, 22, 29, 3, 8

the part of plist it's sorting shown:

<dict> <key>1 september 2012</key> <dict> <key>3</key> <array> <string>georgia tech (orange effect)</string> <string>8:00 pm </string> <string>home</string> </array> <key>8</key> <array> <string>austin peay (white effect)</string> <string>1:30 pm</string> <string>home</string> </array> <key>15</key> <array> <string>pittsburgh (white effect)</string> <string>12:00 pm</string> <string>away</string> </array> <key>22</key> <array> <string>bowling green</string> <string>tba</string> <string>home</string> </array> <key>29</key> <array> <string>cincinnati</string> <string>tba</string> <string>away</string> </array> </dict> 

thank you, appreciate help!

best bet take nsdates have, extract day components nsnumbers or ints , sort , continue have. here might on extracting day component of nsdate.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -