简体   繁体   English

为什么这个iAd没有正确消失?

[英]Why doesn't this iAd properly disappear?

// iAd Advertising
#pragma mark iAd Delegate Methods

- (void) bannerViewDidLoadAd:(ADBannerView *)banner {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1];
    [banner setAlpha:1];
    [UIView commitAnimations];

} // if there is an internet connection, load the iAd with a 1 second fade in effect

- (void) bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1];
    [banner setAlpha:0]; 
    [UIView commitAnimations];
}

When setAlpha is 0 , shouldn't it disappear as opposed to displaying a white line across the screen as a replacement for the ad that isn't there? setAlpha0 ,它不应该消失,而不是在屏幕上显示白线作为替换不存在的广告吗?

I want the banner to completely disappear, but it shows a white banner instead. 我希望横幅完全消失,但它显示的是白色横幅。 I've used this type of animating before and had no problem with it making things completely disappear. 我以前使用过这种类型的动画,没有任何问题,它使事情完全消失。 Is it because it is an iAd banner? 是因为它是iAd横幅吗?

In your header file.. 在你的头文件中..

@property (strong, nonatomic) IBOutlet ADBannerView *adBanner;

In your implementation file.. 在您的实现文件中..

- (void) bannerViewDidLoadAd:(ADBannerView *)banner {
    adBanner.hidden = 0;

}

- (void) bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
    adBanner.hidden = 1;
}

Set your alpha to 0 in your storyboard on the iAd. 在iAd上的故事板中将alpha设置为0。 Then it will work with the code you've provided. 然后它将使用您提供的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM