0

I currently have a table view controller filled with data.

This table view controller leads to a Display view controller which displays the info with the selected data.

I've used a prepareForSegue to send the selected data to the next view controller.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
    if ([[segue identifier] isEqualToString:@"showInfo"]) {


        NSManagedObject *selectedData = [self.datas objectAtIndex:[[self.tableView indexPathForSelectedRow] row]];
        DisplayInfoViewController *destViewController = segue.destinationViewController;
        destViewController.data = selectedData;
    }
}

My problem is that now I've added another view controller (Display More Info View Controller) after that view controller.

tableVC > DisplayVC >DisplayMoreInfoVC

I am having problems passing the same selected data over into the next view controller as my first prepareForSegue gets the selected data from the selected row of the table which i cannot access in the DisplayVC.

Any ideas?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user2512523
  • 1,229
  • 2
  • 15
  • 25
  • I dont get it, if you have all your Data in DisplayVC (because you passed from tableVC) why you just dont pass it from DisplayVC to DisplayMoreInfoVC ? – Pach Jul 08 '13 at 22:34
  • I have been trying to do that but as i am new to iOS development, it just doesnt seem to work....I cant see what i am doing wrong.. – user2512523 Jul 08 '13 at 22:37
  • NSManagedObject *selectedData = [self.database **getdatapassedpreviously**]; DisplayMoreInfoViewController *destViewController = segue.destinationViewController; destViewController.data = selectedData; This is the code i am currently working on... – user2512523 Jul 08 '13 at 22:38

1 Answers1

0

Why are you query the database in the dispayVC Are you passing the same data that you received from tableVC to DisplayMoreInfoViewController? If yes then you can just do

 DisplayMoreInfoViewController *destViewController = segue.destinationViewController;
 destViewController.data = self.data

If it is different the exlplain a little bite more what is

[self.database getdatapassedpreviously]; 
Yan
  • 3,533
  • 4
  • 24
  • 45