In my main UIViewController, I add a home screen view controller as subviews:
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:vc];
controller.navigationBarHidden = YES;
controller.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
[self addChildViewController:controller];
[self.view insertSubview:controller.view atIndex:0];
[controller didMoveToParentViewController:self];
The problem is that viewDidAppear and viewWillAppear are called only once, just like viewDidLoad. Why is this? How do I do this job?
Mostly inside vc, I get neither viewDidAppear nor viewWillAppear.
I also just tried adding a UIViewController without a navigation controller, and it still doesn't work:
vc.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
[self addChildViewController:vc]
[self.view insertSubview:vc.view atIndex:0]
[vc didMoveToParentViewController:self]
source
share