Let's say that on the tap of a UIButton
in ViewControllerA
the following happens before transitioning to ViewControllerB
:
- (IBAction)levelSelectButton:(id)sender {
ViewControllerB* obj = [[ViewControllerB alloc] init];
[self addChildViewController:obj];
CGSize screenSize = [MainScreen screen];
CGFloat screenWidth = screenSize.width;
CGFloat screenHeight = screenSize.height;
obj.view.frame = CGRectMake(0,0,screenWidth,screenHeight);
[obj.view addSubview:_banner];
//[obj didMoveToParentViewController:self];
[self runPushAnimationWithController:obj];
}
When ViewControllerB
shows up, I can see my _banner
(a GADBannerView
object) view in place, but when I return to ViewControllerA
it is no longer there.
I have never used addChildViewController:
/didMoveToParentViewController:
methods before so I don't know if this is expected, but I want to be able to return to ViewControllerA
with _banner
still visible.
Do I need to retain it?