in my app i am getting some queue details value from web server, i have stored the queue id and queue title in NSMutableArray, now i need to sort queue title in alphabetical order, however if i am doing this all my queue id values got mixed up, so how do make this that queue title should be sorted in alphabetical order and stored there respective queue id values.
NSArray *DicPicklistValues = [tempPickList valueForKey:@"PickListValue"];
for(int i=0;i<[DicPicklistValues count];i++){
NSDictionary *tempDic = [DicPicklistValues objectAtIndex:i];
[queueId addObject:[tempDic objectForKey:@"Value"]];
[queueLabel addObject:[tempDic objectForKey:@"Label"]];
}
[queueLabel sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
You could sort the
DicPicklistValuesarray before building thequeueIdandqueueLabelarrays. (Btw. names of variables normally start with a lower case letter.)There is also an easier way to build the
queueIdandqueueLabelarrays: