문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top