How to Hide iAD

前端 未结 1 1841
庸人自扰
庸人自扰 2021-01-07 00:13

I would like to ask the following questions:

1) How to hide iAD when the user clicks on the empty screen? 2) How to identify inactivity i.e. If user has an opened so

相关标签:
1条回答
  • 2021-01-07 00:29

    You can just do something like below code.

    - (void)bannerViewDidLoadAd:(ADBannerView *)banner 
    {   
        if (!self.adBannerViewIsVisible) 
        {
             NSLog(@"\nBanner Success");
             [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
             // assumes the banner view is offset 50 pixels so that it is not visible.
    
             banner.frame = CGRectOffset(banner.frame,0,-94);       
             [UIView commitAnimations];
    
             self.adBannerViewIsVisible = YES;      
        }
    }
    
    - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error 
    {   
          if (self.adBannerViewIsVisible)
          {
              NSLog(@"\nBanner Failed");
              [UIView beginAnimations:@"animateAdBannerOff" context:NULL];          
    
              banner.frame = CGRectOffset(banner.frame, 0, 94);
              [UIView commitAnimations];
    
              self.adBannerViewIsVisible = NO;      
         }  
    }
    

    Just specify location of iAd in your code then you can change it's position by just changing value in this line

    banner.frame = CGRectOffset(banner.frame, 0, 94);`
    

    Hope this may clear what you want.

    0 讨论(0)
提交回复
热议问题