// NSArray * sortedArray = [cache sortedArrayUsingSelector:@selector(compare:)];
{
NSArray * arr1 = @[@"A",@"B",@"C",@"D"];
NSArray * arr2 = @[@"1",@"2",@"3"];
NSArray * arr3 = @[@"x",@"y"];
NSArray * arr4 = @[@"X",@"Y",@"Z"];
self.dic = @{@"1":arr1,@"2":arr2,@"3":arr3,@"4":arr4};
}
如上一个字典,取出其中所有的值
NSArray * cache = [self.dic allKeys];
可以对数组中内容格式化输出一下
NSArray * cache = [self.dic allKeys];
打印结果为无序
UIPickerView[2170:124183] (
3,
1,
4,
2
)
可以通过方法对简单字符串排序
NSArray * sortedArray = [cache sortedArrayUsingSelector:@selector(compare:)];
NSLog(@"%@",sortedArray);
打印结果为有序
时间: 2024-10-28 21:53:37