Note that there are some explanatory texts on larger screens.

plurals
  1. PODifferent NSpredicates in multiple tableviews
    text
    copied!<p>I just can´t stop searching and reading about the "changing of the predicates" but i still don´t know how to resolve my problem, so...what i have is:</p> <p>1 - Several tableviews with various cells and each cell has multiple textfields.</p> <p>2 - The user presses one of these textfields and a tableview(inside a popover) appears.</p> <p>3 - this popoverTableview has all the core data "work" and it is suppose to provide data to insert in the pressed textfields.</p> <p>4 - Everything works fine...EXCEPT the fact that i need the predicate to change every time the user passes for example from tableview1 to tableview2. </p> <p>5 - Below is my NSFetchedResultsController method that is inside my popoverTableview and i have tried numerous approaches like: "if´s" ; "switches" ; also point to the textfield tag in the tableviews and nothing. I think i don´t need to set the cache to nil since it is already set to nil...also tried deleting the: if (_fetchedResultsController != nil) return _fetchedResultsController;</p> <p>And nothing!!!, what do i need to understand? What i´m not getting? i´m losing days on this one.HELP!</p> <pre class="lang-m prettyprint-override"><code>- (NSFetchedResultsController *)fetchedResultsController { if (_fetchedResultsController != nil) { return _fetchedResultsController; } NSFetchRequest *fetchRequestList = [[NSFetchRequest alloc] init]; NSEntityDescription *entityList = [NSEntityDescription entityForName:@"List" inManagedObjectContext:self.managedObjectContext]; [fetchRequestLista setEntity:entityList]; TableViewOne *table1 = [[Cobertura alloc]init]; TableViewTwo *table2 = [[Cobertura alloc]init]; if (table1 textFieldShouldBeginEditing:table1.textFieldPressed) { fetchRequestList.predicate = [NSPredicate predicateWithFormat:@"%K IN %@", @"reference", arrayTableview1]; } if (table2 textFieldShouldBeginEditing:table2.textFieldPressed) { fetchRequestList.predicate = [NSPredicate predicateWithFormat:@"%K IN %@", @"reference", arrayTableview2]; } NSSortDescriptor *cellTitle = [[NSSortDescriptor alloc] initWithKey:@"reference" ascending:YES]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:cellTitle, nil]; [fetchRequestLista setSortDescriptors:sortDescriptors]; _fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequestLista managedObjectContext:self.managedObjectContext sectionNameKeyPath:@"referencia" cacheName:nil]; _fetchedResultsController.delegate = self; self.fetchedResultsController = _fetchedResultsController; return _fetchedResultsController; } </code></pre> <p>Thanks in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload