In my main UIViewController I am adding a homescreen 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 issue is that viewDidAppear and viewWillAppear is only called once, just like viewDidLoad. Why is this? How do I make this work?
Basically inside vc I am not getting viewDidAppear nor viewWillAppear.
I also just tried adding the UIViewController without the 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];
insertSubview:atIndex
instead of justaddSubview
? – ohraddSubview
adds at the end, and yourinsertSubview
adds to the start, but that would only make a difference in the UI if there were other views already on the parent view controller. – RobviewDidAppear
andviewWillAppear
is only called once, just likeviewDidLoad
". Are you saying that the parent view controller is definitely getting it but the child view controllers aren't? Or are you saying that the child only gets it once (in which case I don't understand the question at all)? – Rob