0
我在UIView上有一個廣告橫幅,它在第一次加載視圖時顯示空白區域。我加載視圖時的AdBanner空白空間
已經實現了委託方法,他們被調用和橫幅工作正常。這是
剛開始時的觀點載荷和廣告失敗的第一次,應用程序顯示一個
空白和委託方法不會被調用。 Anyone encountered this?
我在UIView上有一個廣告橫幅,它在第一次加載視圖時顯示空白區域。我加載視圖時的AdBanner空白空間
已經實現了委託方法,他們被調用和橫幅工作正常。這是
剛開始時的觀點載荷和廣告失敗的第一次,應用程序顯示一個
空白和委託方法不會被調用。 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)];
}];
}
發佈廣告橫幅代碼特別是處理廣告未能出現部分的錯誤部分將有所幫助。你用什麼ios?如果您使用的是iOS 6,您有沒有看過最新的iOS廣告示例項目? – 2013-03-24 04:03:48
謝謝,我已將橫幅視圖上的alpha設置爲0,最初解決了問題。然後我淡入淡出。 – Carl 2013-03-24 12:39:06