Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<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>
 

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