我在 UIView 上有一个广告横幅,它在首次加载视图时显示空白。我
已经实现了委托方法,它们被调用并且横幅工作正常。这是
就在视图最初加载并且广告第一次失败时,应用程序会显示
空白和委托方法不会被调用。Anyone encountered this?
我在 UIView 上有一个广告横幅,它在首次加载视图时显示空白。我
已经实现了委托方法,它们被调用并且横幅工作正常。这是
就在视图最初加载并且广告第一次失败时,应用程序会显示
空白和委托方法不会被调用。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)];
}];
}