tags:

views:

19

answers:

0

I am dynamically creating a UIViewController called "MainController" in a Cocos2d application. My nib file contains nothing and I am adding the ADBannerView dynamically as shown in the code below:

MainViewController *controller = [[MainViewController alloc] init]; 
    controller.view.frame = CGRectMake(0,winSize.height-50 , 320, 50);

    controller.bannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];

    controller.bannerView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];

    controller.bannerView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;

    [controller.bannerView setDelegate:controller]; 

    [controller.view addSubview:controller.bannerView];

    [[director openGLView] addSubview:controller.view];

I want to hide the ADBannerView when the viewDidLoad is fired and then make it visible if there are any ads to display. For some reason the viewDidLoad never gets fired. Any help?

UPDATE 1:

I checked in the debugger again and it seems to be getting fired! But it takes a while (1) second to remove the ad from the screen. I wonder if this can be performed instantly!