Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you should have a property with a name other than <code>delegate</code> in your popover controller since <code>UITableViewController</code> already has a <code>delegate</code> property for the <code>UITableViewDelegate</code> protocol; maybe <code>masterTable</code> or something.</p> <p>Then in the <code>selectedObject:</code> implementation in the root UITableView you can do an insert row or add it to the data array and <code>reload</code> the table.</p> <p>Oops, my bad... @geraldWilliam is right, UITableViewController does not have the delegate property...</p> <p>What you have seems like it should work... So does the <strong>selectedObject:</strong> method get called in the delegate? If so, what do you do in that method? If you add the object to the data set (array or dictionary or database) for the root view, insert a row in its tableview (or reload the data), it should work.</p> <p>Here is some code that works for me. It is not from a popover but from a pushed view but there is no reason that should make a difference:</p> <pre><code>- (ThingStatus) thingPicker: (ThingPickerTableViewController *) thingPicker didSelectThing: (Thing *) thing { NSLog( @"Entering %s", __func__ ); // Dismiss the pushed view controller (for you, the popover) [self.navigationController popViewControllerAnimated: YES]; NSArray *startingList = self.currentCellObjectList; [self.databaseManager addThing: thing]; NSArray *endingList = self.databaseManager.thingsForTableView; // Figure out the differences adding made... DiffResult *changes = [startingList simpleDiffWithArray: endingList]; NSLog( @"%d deletions, %d insertions", changes.deletionCount, changes.insertionCount ); // I only handle insertions in this code... deletions would be similar __block NSUInteger objIdx = 0; NSMutableArray *changeableThingList = [startingList mutableCopy]; [changes.insertionIndexes enumerateIndexesUsingBlock: ^( NSUInteger idx, BOOL *stop ) { NSLog( @" - insert %@ at %d", [[changes.insertionObjects objectAtIndex: objIdx] name], idx ); NSIndexPath *indexPath = [NSIndexPath indexPathForRow: idx inSection: 0]; [changeableThingList insertObject: [changes.insertionObjects objectAtIndex: objIdx] atIndex: idx]; self.currentCellObjectList = changeableThingList; [self.tableView insertRowsAtIndexPaths: [NSArray arrayWithObject: indexPath] withRowAnimation: UITableViewRowAnimationRight]; ++objIdx; }]; [self.databaseManager save]; return [self.databaseManager: thingStatus]; </code></pre> <p>}</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. This table or related slice is empty.
    1. This table or related slice is empty.
 

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