すべてのオブジェクトを表示したい場合は、以下のコードを使用します。しかし、キー「Favorite」の値が「Yes」であるオブジェクトのみを表示したい場合は、どうすればよいでしょうか。この例は素晴らしいでしょう。
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle]
pathForResource:@"Objects" ofType:@"plist"];
sortedObjects = [[NSMutableArray alloc]initWithContentsOfFile:path];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [sortedObjects count];
}
追伸 プロパティリストは、辞書を含む配列です。