ios - 失败时隐藏 iAdBanner 并尝试显示我自己的按钮时出错 Xcode iOS7

标签 ios xcode ios7 iad

您好,我想在 iAdBanner 失败时隐藏它,我想用我的其他 URL itunes 应用程序显示我自己的按钮,但它在 iOS 7 上不起作用。有人可以帮助我吗?谢谢!

(iAd 横幅广告正常工作)。

我的代码是:

- (void)viewDidLoad {
    [super viewDidLoad];
    _myBanner.hidden = TRUE;
    _myBanner.enabled = FALSE;
}

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

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

    if (_adBannerViewIsVisible) {

         _adBannerViewIsVisible = NO;
         [self fixupAdView:[UIDevice currentDevice].orientation]; /*This doesn't work*/
    }

    _myBanner.hidden = FALSE;
    _myBanner.enabled = TRUE;

    [ADBannerView removeFromSuperview]; /*This doesn't work*/ 
    [ADBannerView release]; /*This doesn't work*/

}

- (IBAction)tapBanner:(id)sender
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@""]];
}

最佳答案

     - (void)bannerView:(ADBannerView *) banner didFailToReceiveAdWithError:(NSError *)error
            {     
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:1];
            [banner setAlpha:0];
            [UIView commitAnimations];   _myBanner.hidden = YES;

                    _myBanner.enabled = NO;
                    [_myBanner removeFromSuperview]; 
                    [_myBanner release]; 
}

关于ios - 失败时隐藏 iAdBanner 并尝试显示我自己的按钮时出错 Xcode iOS7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24201074/

相关文章:

ios - 如何从一个 viewController 添加多个 Segue

ios - build设置中缺少 Xcode 12 beta 有效架构

Xcode 将 DTXcode key 和其他 key 添加到 Info.plist

ios - MKAnnotationView 总是显示 infoButton 而不是 detailDisclosure btn

objective-c - 将逗号分隔的 NSString 转换为 NSArray

ios - 从 Amazon S3 上的公共(public)图像获取最后修改日期或标志

ios - iOS 8 GM 无限循环中的 layoutSubviews

ios - 核心数据间歇性崩溃 [NSEntityDescription entityForName :inManagedObjectContext:]

UITableView 在 iOS 7 中以偏移量开始

ios - 无法在 iOS7 中显示模态 ViewController