最初の検索基準として 2 つのスライダーの値を使用しています。
次に、2 つ目の基準が必要です。私は
NSMutableArray *suitsArray;
これは最大 10 個の単語を含むか、空 (0 個の単語) にすることができます。配列の例:
2012-08-12 03:13:14.825 App[4595:f803] The content of array is(
mushroom,
grill,
pizza
)
私が欲しいのはこれです:
suitArray が上記のように、単語のきのこ、グリル、およびピザを含む場合
辞書の「スーツ」値は次のとおりです。「このワインは、キノコ料理、グリル料理、ピザ、チキンに適しています。」
このディクショナリは searchResultsArray に追加されます。他のすべてのディクショナリと同様に、"Suits" の値には、単語のきのこ、グリル、およびピザが含まれます。
ただし、suitsArray にオブジェクトが含まれていない場合は、この条件をスキップしてください。
しかし、そのコードの書き方がわかりません。手伝ってもらえますか?
-(IBAction)searchButtonPressed:(id)sender{
resultObjectsArray = [NSMutableArray array];
for(NSDictionary *object in allObjectsArray)
{
NSString *objectPrice = [object objectForKey:@"75 cl price"];
NSString *suitsString = // the words in suitsArray
NSString *objectSuits = [object objectForKey:@"Suits"];
BOOL priceConditionGood = YES;
if (minPrisSlider.value <= maxPrisSlider.value && (winePrice.floatValue < minPrisSlider.value || winePrice.floatValue > maxPrisSlider.value))
priceConditionGood = NO;
if (priceConditionGood)
[resultObjectsArray addObject:object];
}
ResultsTableViewController *nextController = [[self storyboard] instantiateViewControllerWithIdentifier:@"ResultsController"];
nextController.objectsArray = [[NSMutableArray alloc]initWithArray:resultObjectsArray];
[self.navigationController pushViewController:nextController animated:YES];
}