2011-10-14 31 views
2

自從升級到iOS 5後,我遇到了iAds問題。我發現當廣告無法顯示時,它顯示出一個大的白色塊,其中iAd通常是。有沒有辦法解決這個問題?我嘗試設置iAd的背景顏色以匹配我的UIView的背景顏色,但那不起作用。iAds在無法顯示時離開白色塊

回答

1

我想你應該只是移動屏幕的旗幟如下面的例子,可以是here

Error Handling

If an error occurs, the banner view calls the delegate’s bannerView:didFailToReceiveAdWithError: method. When this happens, your application must hide the banner view. Listing 2-3 shows one way you might implement this. It uses the same property as Listing 2-2 to keep track of whether the banner is visible. If the banner is visible and an error occurs, it moves the banner off the screen.

Listing 2-3 Removing a banner view when advertisements are not available

  • (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error

{

if (self.bannerIsVisible)

{

[UIView beginAnimations:@"animateAdBannerOff" context:NULL]; 

// Assumes the banner view is placed at the bottom of the screen.

banner.frame = CGRectOffset(banner.frame, 0, banner.frame.size.height); 

    [UIView commitAnimations]; 

    self.bannerIsVisible = NO; 

}

}

Even after an error is sent to your delegate, the banner view continues to try to download new advertisements. Thus, implementing both of these delegate methods allows your application to display the banner only when advertisements are loaded.

希望這有助於你

2

很老的問題,所以會得到擊落回答,但是當我需要答案時,我發現了這個線索。我自從找到了答案,並認爲我應該像其他人一樣在這個話題上絆倒。

在IB中bannerView具有背景顏色。將其設置爲與背景相同的顏色:-) 清除顏色,如果是代碼也許

還請記住將橫幅視圖啓動爲隱藏狀態。所以只有在顯示視圖時纔會出現。如果它的開始不隱藏,那麼它會嘗試加載廣告失敗,然後消失。這就是爲什麼你得到空白。隱藏在IB中或隱藏在視圖中的方法