Hello,
if this has been asked and answered please point me out to the right direction!
i m playing around with the iphoneCoreDataRecipes Apple sample code and trying to implement a UISearchBar.
what i have done is created a searchcontroller and populated it s contents with a master list. here is the code:
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *RecipeCellIdentifier = @"RecipeCellIdentifier";
RecipeTableViewCell *recipeCell = (RecipeTableViewCell *)[tableView dequeueReusableCellWithIdentifier:RecipeCellIdentifier];
if (recipeCell == nil) {
recipeCell = [[[RecipeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:RecipeCellIdentifier] autorelease];
//recipeCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
Recipe *recipe = nil;
if( tableView == self.searchDisplayController.searchResultsTableView)
{
recipe = [self.filteredListContent objectAtIndex:indexPath.row];
}
else
{
recipe = (Recipe *)[fetchedResultsController objectAtIndexPath:indexPath];
}
[self configureCell:recipeCell atIndexPath:indexPath];
return recipeCell;
}
The app crashes when i try to type in the searchbar here:
recipe = [self.filteredListContent objectAtIndex:indexPath.row];
any ideas?
thank you
ps. any good tutorials for UISearchBar and CoreData???