I have the following ADBannerViewDelegate implementations:
#pragma mark ADBannerViewDelegate Methods
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
self.headerView.frame = CGRectMake(0, 0, 320, 94);
[self.tableView setTableHeaderView:headerView];
adBannerView.hidden = FALSE;
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
headerView.frame = CGRectMake(0, 0, 320, 50);
[self.tableView setTableHeaderView:headerView]; //hide the ad if it doesnt fill
adBannerView.hidden = TRUE;
}
If an ad is unavailable, I want to shrink my headerview. If there is an ad, I want to expand it.
This works fine, when the view loads. However, it seems like these delegate methods stop getting called after the view has loaded. I can possibly run into the following scenario:
- View A loads, but no iAd is available so headerView is shrunken
- User goes to View B
- User comes back to View A
- PROBLEM: View A has already loaded, so the headerView is shrunken, but the ADBannerViewDelegate methods aren't called, so I can't check to see if an ad is available
How can I make sure these delegate methods get called even after the view has been initially loaded?