Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I edit my segue target data through prepareForSegue?
    primarykey
    data
    text
    <p>I am trying to edit the segue's target's data through <code>prepareForSegue</code>, but everything I try keeps returning the "unrecognized selector sent to instance ..." error. Is there a special way to edit my target's data, is it being deleted before I edit it or something like that? I just started picking this stuff up so I still don't have my head all the way around it. Here is a sample of some of my code</p> <pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if([segue.identifier isEqualToString:@"managerSegue"]){ ASExpenseList *target = [segue destinationViewController]; NSIndexPath *row = [self.tableView indexPathForSelectedRow]; self.cellPressed = row.row; switch(self.cellPressed){ case 0: [target initWithData:self.oneTimeExpenses]; //PROBLEM LINE // target.expenses = [[NSMutableArray alloc] initWithArray:self.oneTimeExpenses]; ALSO PROBLEM target.title = @"One-Time"; //not breaking the program but not working </code></pre> <p>The <code>ASExpenseList</code> function I'm calling is really simple:</p> <pre><code>-(void) initWithData:(NSMutableArray *)newExpenses { self.expenses = newExpenses; [self.tableView reloadData]; } </code></pre> <p>So I am trying to set the target's data to some data I already have, and I am trying to dynamically change the title. The title change isn't working and the data lines are throwing errors. I'm guessing that I just misunderstand how it works, so any help or clarification would be awesome. 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.
 

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