Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If the fetched results controller is for the popover table and you need to know in which table the text field was selected, I'd recommend tagging each of the text fields when you create them and creating an <code>int _currentTable</code> instance variable. That way, when your <code>textFieldShouldBeginEditing:</code> method is called, you can set the ivar's value with the tag and check that tag when creating the fetched results controller for the popover table.</p> <p>So, instead of</p> <pre class="lang-m prettyprint-override"><code>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]; } </code></pre> <p>you'll have</p> <pre class="lang-m prettyprint-override"><code>if (_currentTable == 1) { fetchRequestList.predicate = // table one predicate } else if (_currentTable == 2) { fetchRequestList.predicate = // table two predicate } </code></pre> <p>UPDATE:</p> <p>This is how I would override the init from code. In your popover table view controller implementation:</p> <pre class="lang-m prettyprint-override"><code>- (id)initWithTableTag:(int)tableTag { self = [super init]; if (self) { _currentTable = tableTag; } return self; } </code></pre> <p>(Make sure you also declare <code>- (id)initWithTableTag:(int)tableTag;</code> in your header.) Then, when you create and present the popover controller (which I'm assuming you're doing in the textFieldShouldBeginEditing: delegate call):</p> <pre class="lang-m prettyprint-override"><code>- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { // ... YourPopoverTableViewControllerClass *vc = [[YourPopoverTableViewControllerClass alloc] initWithTableTag:textField.tag]; // ... // display the popover return YES; } </code></pre> <p>Unfortunately, I don't know how to do this using storyboards.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. COHello enjayem, thanks for answering to my post, this issue is making me lose a lot of days and i still don´t know what it is wrong.You´re second suggestion is the one i´m pursuing. In each tableview(1,2,3) i have a textfield variable (textfieldPressed) and when i´m instantiating the popoverTableview(as i showed you before) i have putted this:[popoverTableview.tableView setTag:textFieldPressed.tag]; Now in my NSFetchedResultsController (in my popoverTableview) do what you were saying about the _current table, check it´s tag right?but he feches all results,doesn't respect the if´s..what?!?!?.
      singulars
    2. COI imagine that the FRC is getting loaded before the tag is set. If so, you can do two different things: (1) override the init method to pass the tag when creating the popover (This would be my preferred method, but I don't have any experience with storyboards, so I don't quite know how to do it other than through code.) or (2) override the setTag: method in your custom popover view controller to tell it to wipe out the current FRC and load a new one.
      singulars
    3. COpopoverTableview = [self.storyboard instantiateViewControllerWithIdentifier:@"popoverTableview"]; popover = [[UIPopoverController alloc] initWithContentViewController:popoverTableview]; popoverTableview.tableview.tag=textFieldPressed; What is confusing to me is that this is the moment when i´m creating the popovertableview inside one of my tableviews, and i have putted a NSlog and the popovertableview.tableview.tag has the same tag as the textfieldpressed. How can i override the init method? I´m also new at this..
      singulars
 

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