I have 2 tableView
s at the moment.
One is a basic tableView
which shows cells and if selected, it goes into a detailed viewController
.
I created a new viewController
to create a filtered
page view. I populate my page view with a plist. I managed to create a filter but don't know how to proceed from here.
This is what I have:
- (IBAction)ingredientsAddButton:(UIButton *)sender
{
int j=0;
onemsiz.text=ingredientTextField.text;
ingredientText=onemsiz.text;
NSLog(ingredientText);
NSString *path = [[NSBundle mainBundle] pathForResource:@"recipes" ofType:@"plist"];
NSArray *arrayOfPlist = [[NSArray alloc] initWithContentsOfFile:path];
if (arrayOfPlist==NULL) {
}else {
for (int i=0; i<4; i++) {
// i currently have 4 element is plist.
NSString *strCurrentRecipeIngredients = [[arrayOfPlist objectAtIndex:i] objectForKey:@"recipeIngredients"];
NSString *strCurrentRecipeName = [[arrayOfPlist objectAtIndex:i] objectForKey:@"recipeName"];
//NSLog(@"%d. Loop
", i+1);
if([strCurrentRecipeIngredients rangeOfString:(@"%@",ingredientText)].location!=NSNotFound) {
NSLog(@"%@ contains %@ ",strCurrentRecipeName, ingredientText);
NSLog(ingredientText);
NSLog(strCurrentRecipeIngredients);
j++;
}else {
NSLog(@"Not found");
NSLog(ingredientText);
NSLog(strCurrentRecipeIngredients);
}
if (ingredientText==NULL) {
NSLog(@"empty input");
}else {
}
}
}
NSLog(@"%d",j);
}
My first problem is how can I show the results in a tableView
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…