viewDidAppear not getting called

后端 未结 8 1040
醉酒成梦
醉酒成梦 2021-01-12 00:17

In my main UIViewController I am adding a homescreen view controller as subviews:

   UINavigationController *controller = [[UINavigationController alloc] ini         


        
8条回答
  •  死守一世寂寞
    2021-01-12 00:35

    Presenting view controllers using presentModalViewController or segues or pushViewController should fix it.

    Alternatively, if for some reason you want to present your views without the built-in methods, in your own code you should be calling these methods manually. Something like this:

    [self addChildViewController:controller];
    BOOL animated = NO;
    [controller viewWillAppear:animated];
    [self.view insertSubview:controller.view atIndex:0];
    [controller viewDidAppear:animated];
    [controller didMoveToParentViewController:self];   
    

提交回复
热议问题