加载视图时的广告横幅空白



我在UIView上有一个广告横幅,当视图第一次加载时显示空白。我

已经实现了委托方法,它们被调用,横幅工作得很好。

就在视图初始加载和AD第一次失败时,应用程序显示一个

空白和委托方法不会被调用。Anyone encountered this?

// Step 1 : add iAd.framework to your project
// Step 2 : #import <iAd/iAd.h>
// Step 3 : ADBannerViewDelegate to your viewController
// Step 4 : Initialize your adBanner in your viewDidLoad Method
    myIad = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner];
    [myIad setFrame:CGRectMake(0, self.view.frame.size.height, myIad.frame.size.width, myIad.frame.size.height)];
    [myIad setDelegate:self];
// Step 5 : Implement following Delegate method to show and hide your bannerView
#pragma mark - AdBanner Delegate
- (void)bannerViewWillLoadAd:(ADBannerView *)banner
{
}
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    // Show Add Banner
    [UIView animateWithDuration:0.25f animations:^{
        [banner setFrame:CGRectMake(0, self.view.frame.size.height-banner.frame.size.height, self.view.frame.size.width, self.view.frame.size.height)];
    }];
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    // Hide with animation as failed to load ad
    [UIView animateWithDuration:0.25f animations:^{
        [banner setFrame:CGRectMake(0, self.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height)];
    }];
}

相关内容

  • 没有找到相关文章

最新更新