- (void)sortWifiList {
NSArray *resultArray = [myDataArray sortedArrayUsingFunction:compare context:NULL];
[myDataArray removeAllObjects];
[myDataArray addObjectsFromArray:resultArray];
}
NSComparisonResult compare(NSDictionary *firstDict, NSDictionary *secondDict, void *context) {
if ([[firstDict objectForKey:@"SSIDSortKey"] intValue] < [[secondDict objectForKey:@"SSIDSortKey"] intValue])
return NSOrderedAscending;
else if ([[firstDict objectForKey:@"SSIDSortKey"] intValue] > [[secondDict objectForKey:@"SSIDSortKey"] intValue])
return NSOrderedDescending;
else
return NSOrderedSame;
}