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. }
  • 相关阅读:
    创建网络数据集
    [虚拟机]Virtual Box的使用--共享文件夹
    MapControl图层删除或添加触发监听事件
    Dev控件GridView单元格绑定控件
    Log4net中换行符
    没有为 COM 互操作注册程序集 请使用 regasm.exe /tlb 注册该程序集——解决办法
    加载dll过程中assembly失败
    Spring Boot 自带缓存及结合 Redis 使用
    Spring Boot + Redis 初体验
    在 Windows 中使用 C# 启动其他程序
  • 原文地址:https://www.cnblogs.com/zhangyang17/p/3587476.html
Copyright © 2011-2022 走看看