2013-03-23 73 views
0

我在UIView上有一个广告横幅,它在第一次加载视图时显示空白区域。我加载视图时的AdBanner空白空间

已经实现了委托方法,他们被调用和横幅工作正常。这是

刚开始时的观点载荷和广告失败的第一次,应用程序显示一个

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

+0

发布广告横幅代码特别是处理广告未能出现部分的错误部分将有所帮助。你用什么ios?如果您使用的是iOS 6,您有没有看过最新的iOS广告示例项目? – 2013-03-24 04:03:48

+0

谢谢,我已将横幅视图上的alpha设置为0,最初解决了问题。然后我淡入淡出。 – Carl 2013-03-24 12:39:06

回答

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)]; 
    }]; 
}