Ios 从服务器分组数据而不按字母排序
我需要来自web服务的组数据,我已经使用dictionary完成了这项工作,但它按字母顺序排序,我不需要排序,我希望它以web服务中的方式显示Ios 从服务器分组数据而不按字母排序,ios,objective-c,web-services,sorting,grouping,Ios,Objective C,Web Services,Sorting,Grouping,我需要来自web服务的组数据,我已经使用dictionary完成了这项工作,但它按字母顺序排序,我不需要排序,我希望它以web服务中的方式显示 self.searchSections = [[NSMutableDictionary alloc] init]; NSError *error = nil; NSDictionary *xmlDict = [XMLReader dictionaryForXMLString:Str error:&error]; NSA
self.searchSections = [[NSMutableDictionary alloc] init];
NSError *error = nil;
NSDictionary *xmlDict = [XMLReader dictionaryForXMLString:Str error:&error];
NSArray *leaguelist = [[[xmlDict objectForKey:@"GetLeagueNamesListOutput"] objectForKey:@"Leagues"] objectForKey:@"eLeagueMst"];
if (leaguelist.count>0)
{
if (![leaguelist isKindOfClass:[NSArray class]])
{
// if 'list' isn't an array, we create a new array containing our object
leaguelist = [NSArray arrayWithObject:leaguelist];
}
// we can loop through items safely now
for (NSDictionary *item in leaguelist)
{
NSString *c = [[item objectForKey:@"CountryName"] objectForKey:@"text"];
found = NO;
for (NSString *str in [self.searchSections allKeys])
{
if ([str isEqualToString:c])
{
found = YES;
}
}
if (!found)
{
[self.searchSections setValue:[[NSMutableArray alloc] init] forKey:c];
}
}
// Loop again and sort the books into their respective keys
for (NSDictionary *book in leaguelist)
{
[[self.searchSections objectForKey:[[book objectForKey:@"CountryName"] objectForKey:@"text"]] addObject:book];
}
显示您的代码。。。其他智者帮不上忙你能分享你的代码吗?有谁能帮我吗