我必須使用NSMutableSet
來存儲我的字符串對象。我婉他們在正確的順序存儲例如從最小到最大數量:排序NSMutableSet
1
2
3
4
如何以往,如果做到這一點:
NSMutableSet *set = [[NSMutableSet alloc] init];
[set addObject:[NSString stringWithFormat:@"1"]];
[set addObject:[NSString stringWithFormat:@"2"]];
[set addObject:[NSString stringWithFormat:@"3"]];
[set addObject:[NSString stringWithFormat:@"4"]];
NSLog(@"set is %@",set);
[set release];
我沒有得到我想要,而是這樣的:
set is {(
3,
1,
4,
2
)}
所以我想我需要排序他們得到想要的結果?但我真的找不到任何例子。
也許有人可以幫助我呢?
謝謝。
編輯: 我不能使用其他。只是NSMutableSet
或NSSet
爲什麼couldn你用NSMutableOrderedSet還是NSOrderedSet? – 2013-09-14 06:42:56