我有一個NSDictionary包含幾個數組與幾個字符串在他們。我想把每個數組下的所有字符串放在一個數組中。我怎樣才能一次接收所有的字符串?我已經試過這樣:我如何按字母順序排列NSDictionary中的值與NSArray?
NSMutableArray *mutarr = [[NSMutableArray alloc] initWithObjects:[self.firstTableView allValues], nil];
NSArray *mySorted = [[NSArray alloc]init];
mySorted = [mutarr sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
NSLog(@"First table view values: %@", mySorted);
注:self.firsttableview是這樣一個的NSDictionary:
NSString *path = [[NSBundle mainBundle] pathForResource:@"firstTableView" ofType:@"plist"];
self.firstTableView = [NSDictionary dictionaryWithContentsOfFile:path];
效果:這讓我在NSLog的列表,但它不是按字母順序排列。
根據描述,這將導致數組的數組,而不是一個字符串數組。 – Wain
謝謝。編輯。 –
謝謝你爲我工作! –