1
알파벳순으로 plist에 삽입 된 데이터를 정렬 할 수 있습니까? 그리고 어떻게? 배열이나 다른 메서드를 사용하여 도트하는 방법이 아닌 경우? advace에서plist에서 데이터를 정렬하는 방법?
덕분에 StackOverflow에
알파벳순으로 plist에 삽입 된 데이터를 정렬 할 수 있습니까? 그리고 어떻게? 배열이나 다른 메서드를 사용하여 도트하는 방법이 아닌 경우? advace에서plist에서 데이터를 정렬하는 방법?
덕분에 StackOverflow에
// read the file into a dictionary
NSString *path = [[NSBundle mainBundle] pathForResource:@"yourfile" ofType:@"plist"];
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
// sort it
NSArray *sortedArray = [[myDict allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
// iterate and print results
for(NSString *key in sortedArray) {
NSLog(@"key=%@,value=%@", key, [dict objectForKey:key]);
}
에 오신 것을 환영합니다. 질문을 게시하기 전에 FAQ를 읽으십시오. 또한 질문을 게시하기 전에 검색 기능을 사용하여 대답을 찾으십시오. 이 주제에 이미 게시 된 많은 질문과 답변이 있습니다. – Till