Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iAdBanner未出现在iOS 7上_Ios_Xcode_Position_Constraints - Fatal编程技术网

iAdBanner未出现在iOS 7上

iAdBanner未出现在iOS 7上,ios,xcode,position,constraints,Ios,Xcode,Position,Constraints,我在屏幕底部有一个横幅。当我在iOS 8上运行我的应用程序时,它就像一个魔咒。但当我在iOS 7上运行应用程序时,它不会出现 当我清除iADBanner的约束并仅将其放置在底部时,iADBanner会出现在两个iOS版本中,但Xcode会向我显示“缺少的约束:缺少的位置X”。如果我放置位置X,我们将返回到iOS 7上未显示iADBanner的问题 有什么建议吗?这是我在iOS 7和iOS 8上的工作: 在viewDidLoad中: 方法: - (void)bannerViewDidLoadAd

我在屏幕底部有一个横幅。当我在iOS 8上运行我的应用程序时,它就像一个魔咒。但当我在iOS 7上运行应用程序时,它不会出现

当我清除iADBanner的约束并仅将其放置在底部时,iADBanner会出现在两个iOS版本中,但Xcode会向我显示“缺少的约束:缺少的位置X”。如果我放置位置X,我们将返回到iOS 7上未显示iADBanner的问题


有什么建议吗?

这是我在iOS 7和iOS 8上的工作:

在viewDidLoad中:

方法:

 - (void)bannerViewDidLoadAd:(ADBannerView *)banner {
        if (!_bannerIsVisible) {
        // If banner isn't part of view hierarchy, add it
        if (_adBanner.superview == nil) {
             [self.view addSubview:_adBanner];
         }

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

         // Assumes the banner view is just off the bottom of the screen.
          banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height);

         [UIView commitAnimations];

         _bannerIsVisible = YES;
     }
 }


 - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
 {
     NSLog(@"Failed to retrieve ad");

     if (_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];

         _bannerIsVisible = NO;
     }
 }

希望这有帮助

谢谢,95%是我需要的解决方案!
 - (void)bannerViewDidLoadAd:(ADBannerView *)banner {
        if (!_bannerIsVisible) {
        // If banner isn't part of view hierarchy, add it
        if (_adBanner.superview == nil) {
             [self.view addSubview:_adBanner];
         }

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

         // Assumes the banner view is just off the bottom of the screen.
          banner.frame = CGRectOffset(banner.frame, 0, -banner.frame.size.height);

         [UIView commitAnimations];

         _bannerIsVisible = YES;
     }
 }


 - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
 {
     NSLog(@"Failed to retrieve ad");

     if (_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];

         _bannerIsVisible = NO;
     }
 }