0

UIViewに広告バナーがあり、ビューが最初に読み込まれたときに空白が表示されます。私

デリゲートメソッドを実装し、それらが呼び出され、バナーが正常に機能します。です

ビューが最初に読み込まれ、広告が初めて失敗したときに、アプリは

空白とデリゲートメソッドは呼び出されません。Anyone encountered this?

4

1 に答える 1

0
// 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)];
    }];
}
于 2013-03-24T11:18:43.567 に答える