开发者

iAds leaving white block when unable to show

I'm having an issue with iAds si开发者_运维问答nce updating to iOS 5. I found that when the ads can't be displayed it is showing a large white block where the iAd would normally be. Is there a way to resolve this issue? I tried setting the background colour of the iAd to match my UIView's background colour but that didn't work.


very old question so will get shot down for answering, but I found this thread when I needed the answer. I since found the answer and thought I should post in incase others stumble upon this thread as I did.

in IB the bannerView has a background colour. Set it to same colour as your background :-) clear color if doing is code maybe

Also remember to start the banner view as hidden. So it only appears when view is shown. if its starts unhidden then it will try to load an ad fail then disappear. which is why you get the white space. set hidden in IB or in viewdidload method


I think you should just move the banner of screen as shown in the following example that can be here

Error Handling

If an error occurs, the banner view calls the delegate’s bannerView:didFailToReceiveAdWithError: method. When this happens, your application must hide the banner view. Listing 2-3 shows one way you might implement this. It uses the same property as Listing 2-2 to keep track of whether the banner is visible. If the banner is visible and an error occurs, it moves the banner off the screen.

Listing 2-3 Removing a banner view when advertisements are not available

  • (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error

{

if (self.bannerIsVisible)

{

   [UIView beginAnimations:@"animateAdBannerOff" context:NULL];

// Assumes the banner view is placed at the bottom of the screen.

   banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height);

   [UIView commitAnimations];

   self.bannerIsVisible = NO;

}

}

Even after an error is sent to your delegate, the banner view continues to try to download new advertisements. Thus, implementing both of these delegate methods allows your application to display the banner only when advertisements are loaded.

Hope this helps you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜