+ (NSArray *) sortedArrayFromDictionary:(NSDictionary*)dict
{
if (dict == nil) return nil;
NSArray *keys = [dict allKeys];
NSArray *sortedKeys = [keys sortedArrayUsingSelector:@selector(compare:)];
NSMutableArray *array = [NSMutableArrayarrayWithCapacity:keys.count];
for (NSString *key in sortedKeys)
{
NSString *object = [dict objectForKey:key];
if (object)
{
SelectItem *item = [[SelectItem alloc] init];
item.idNumber = key;
item.name = object;
item.selected = NO;
[array addObject:item];
}
}
return array;
}