Question

I have a parentVC with a container view, i have this container on hidden. When i press a button on the parentVC, the container becomes visible. I want to reload the viewDidLoad when it becomes visible.

I tried in prepareForSegue to create an instance of the child vc and reload the viewdidload like this:

    if([segue.identifier isEqualToString:@"listZone"]){
        PickerZone *destination = segue.destinationViewController;
        destination.parentVC = self;
        [destination viewDidLoad];
        [destination.listZone reloadAllComponents];

I also tried to create a method in the child and call it in the parent but it doesn't get triggered.

I'd appreciate your help!

Was it helpful?

Solution

You don't ever want to be directly calling viewDidLoad on a view. This is called automatically after the view is loaded. You might want to move some or all of your code to its own method and then call that method both inside that view controller's -viewDidLoad method and in your code when you want it to refresh.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top