Passing Data To Container View From Parent View

Viewed 2145

So I've seen some examples of this and have tried implementing them but can't seem to get it to work. I have Two VCs (both marked as VC1 in my photo) which go to a second view controller (VC2 in photo). VC2 has a container view. I pass data from a property on VC1 to a property on VC2 and then I need to pass that data from V2 to a property on container view. Based on using some NSLogs it appears that the prepare for segue for my embedded segue that goes from VC2 to my container view is firing off before the property on VC2 is being set by the data passed by VC1, which means no data is being passed to my container view. Any way to get around this? Thanks in advance.

This is my prepareForSegue in VC2:

my container view is WineryPhotosCVC. I'm trying to set WineryPhotosCVC's winery property with VC2s winery property. VC2s winery property is not being set by VC1 before the prepareForSegue to my container view is called.

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

if ([segue.identifier isEqual: @"containerViewSegue"]) {
    WineryPhotosCVC *wineryPhotosCVC = segue.destinationViewController;
    wineryPhotosCVC.winery = _winery;
   }
}

enter image description here

2 Answers
Related