I\'m trying to make sections in a table view based on the alphabet and sort my entries alphabetically under these sections.
I have collected the first letter in every en
Sorry, I didnt notice you had a NSArray of NSDictionaries.
Read this thread: Using NSPredicate to filter an NSArray based on NSDictionary keys
When you use NSDictionary, you should check by its Key... I'm not sure you're using the right approach!
I would do something like: @implementation Word : NSObect { NSString *title; }
then I would create a NSArray of Words and filter on them with: @"title beginswith[c] %@"
Do you mean that bandsArray
is an array of dictionaries? If so, and assuming each dictionary has a name
key, you should be able to change the predicate to something like @"SELF.name beginswith[c] %@"
.
If, on the other hand, bandsArray
is actually a dictionary itself, maybe you want to do [[bandsArray allKeys] filteredArrayUsingPredicate...]
.
#import <Foundation/Foundation.h>
// clang -framework Foundation Siegfried.m
int
main() {
NSArray *arr = @[
@{@"1" : @"Fafner"},
@{@"1" : @"Fasolt"}
];
NSPredicate *p = [NSPredicate predicateWithFormat: @"SELF['1'] CONTAINS 'e'"];
NSArray *res = [arr filteredArrayUsingPredicate:p];
NSLog(@"Siegfried %@", res);
return 0;
}