【发布时间】:2014-03-10 19:35:47
【问题描述】:
我目前有 2 个表格视图。一个是基本的,它显示每个单元格,如果选中,它会导航到详细视图控制器。
我创建了一个新的 ViewController 来创建过滤的页面视图。我用 plist 填充我的页面视图。我设法创建了一个过滤器,但我不知道如何从这里开始。
这是我的代码:
- (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 \n", 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);
}
我的第一个问题是如何在表格视图中显示结果?如果你愿意,我可以提供一些截图。
【问题讨论】:
-
它与您之前的问题stackoverflow.com/questions/22306047/… 100% 重复,而且它的表述与上一个问题一样糟糕。
-
这个问题似乎离题了,因为它的表述非常糟糕。
标签: ios objective-c cocoa-touch uipageviewcontroller