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. }
  • 相关阅读:
    [译]javascript中的条件语句
    [译]Javascript substring实例
    [译]Javasctipt中的substring
    [译]在Javascript中将string转化成numbers
    [译]Javascript基础
    [译]我们应该在HTML文档中何处放script标签
    [译]内联Javascript vs 外置Javascript
    [译]学习Javascript的工具
    MYSQL 重新设置自增值
    LINUX下的ssh登录之后的文件远程copy:scp命令(接前文ssh登录)
  • 原文地址:https://www.cnblogs.com/zhangyang17/p/3587476.html
Copyright © 2011-2022 走看看