Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS Core Data - Design Pattern for Passing Context to Detail Views
    primarykey
    data
    text
    <p>I'm a little stumped with an issue that I think goes back to my design.</p> <p>I'm constructing a TableViewController based on a mainly static set of rows (4) - using that as a basis for a UITableView. Each row will kick off varying different views (detail, and UITableViews)... In my managed object context for the top view I can easily nav to the associated detail view because it's in context (nickname).. I initially thought about simply having unrelated tables and a series of buttons that would fire off the views... But I ditched that idea. My main current issue is knowing how to switch MOC or to different fetchedresults controllers (which are by the way defined in each .m to fetch from different tables.</p> <p>At the moment, I've got a switch inside of TableViewControler.m.. This snipit works:</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSInteger switchval = indexPath.row; switch (switchval) { case 0: // Nickname { //This version brings up a detailed view controller - NickNameDetail *controller = [[NickNameDetail alloc] initWithNibName:@"NickNameDetail" bundle:nil]; controller.fetchedResultsController = self.fetchedResultsController; controller.managedObjectContext = [self.fetchedResultsController objectAtIndexPath:indexPath]; [self.navigationController pushViewController:controller animated:YES]; break; } case 1: { //NextTableViewContoller *.... (etc)... here here ... </code></pre> <p>However, I can't figure out how to switch to a different context and get different rows.</p> <pre><code>meTableViewController.managedObjectContext = self.managedObjectContext; nickNameDetail.managedObjectContext = self.managedObjectContext; nextTableViewController.managedObjectContext = self.managedObjectContext; </code></pre> <p>Anyone run into a scenario like this before? Sorry, can't get the code formatter to behave.</p> <p>Thanks!</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.
 

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