如何隐藏iAD [英] How to Hide iAD

查看:123
本文介绍了如何隐藏iAD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问下列问题:

1)当用户点击空白屏幕时如何隐藏iAD?
2)如何识别不活动,即如果用户打开某个应用程序并离开iPhone并离开并且应用程序保持打开状态?

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 some application and leave the iphone and went away and application remained open?

更新:

Update:

根据苹果文档,此方法负责解除iAD。但是这种方法仍然无法在我的代码中使用。任何样本或此方法的工作原理?

According the apple documentation, this method is responsible for dismissing the iAD. but this method is still not working in my code. Any sample or how this method works?

- (void)cancelBannerViewAction

- (void)cancelBannerViewAction

说明:

横幅视图操作可以涵盖应用程序的用户界面。但是,您的应用程序继续运行,并正常接收事件。如果您的应用程序收到需要用户注意的事件,它可以通过调用cancelBannerViewAction以编程方式取消操作并显示其界面。经常取消操作可能会导致您的应用程序损失收入。

A banner view action can cover your application’s user interface. However, your application continues to run, and receives events normally. If your application receives an event that requires the user’s attention, it can programmatically cancel the action and uncover its interface by calling cancelBannerViewAction. Canceling actions frequently can cause a loss of revenue for your application.

Apple的参考

但是我仍然无法执行?此方法无法正常工作

But still I am unable to execute? This method is not working properly

推荐答案

您可以执行以下代码之类的操作。

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;      
     }  
}

只需在代码中指定iAd的位置即可只需更改此行中的值即可更改其位置

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.

这篇关于如何隐藏iAD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆