zoukankan      html  css  js  c++  java
  • iOS添加广告的主要方法

      1. //用户取消正在执行的广告时 调用  
      2. - (void)cancelBannerViewAction {  
      3.     NSLog(@"Banner was cancelled!");  
      4.       
      5.     self.adStatus.text = @"[iAd]: Bannes was closed.";  
      6. }  
      7.   
      8. //苹果公司给你发送一个广告 ! 通过此方法,广告视图ADBannerView 开始显示  
      9. //此方法,每间隔一段时间(46秒) 刷新一次  
      10. - (void)bannerViewDidLoadAd:(ADBannerView *)banner {  
      11.     NSLog(@"[iAd]: Ad did load.");  
      12.     self.adStatus.text = @"[iAd]: Ad did load.";  
      13. }  
      14.   
      15. //someone 点击了 广告  
      16. - (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {  
      17.     NSLog(@"[iAd]: An action was started from the banner. Application will quit: %d", willLeave);  
      18.       
      19.     self.adStatus.text =[NSString stringWithFormat: @"[iAd]: An action was started from the banner. Application will quit: %d", willLeave];  
      20.       
      21.     return YES;  
      22. }  
      23. //广告执行完成,返回  
      24. - (void)bannerViewActionDidFinish:(ADBannerView *)banner {  
      25.     NSLog(@"[iAd]: Action finished.");  
      26.       
      27.     self.adStatus.text = @"[iAd]: Action finished.";  
      28. }  
      29. //加载广告错误,或者没有广告时,调用此方法,因为广告有时候会显示,有时候不会  
      30. - (void)bannerView:(ADBannerView *) didFailToReceiveAdWithError:(NSError *)error {  
      31.     NSLog(@"[iAd]: Faild to load the banner: %@", error);  
      32.       
      33.     self.adStatus.text = [NSString stringWithFormat:@"[iAd]: Faild to load the banner: %@", error];  
      34. }
  • 相关阅读:
    常用DOS命令大全2
    常用DOS命令大全1
    2020年3月13日Java面试记录
    MySQL Transaction--Sprint中访问只读从库的设置
    MySQL Transaction--TPS计算规则
    MySQL Inport--导入数据
    MySQL Export--导出数据
    MySQL--InnoDB并发线程控制
    MySQL--线程池(Thread Pool)
    MySQL 5.7--复制延迟监控
  • 原文地址:https://www.cnblogs.com/zhangyang17/p/3587476.html
Copyright © 2011-2022 走看看