简体   繁体   English

如何暂停iAd横幅?

[英]How to pause iAd banner?

I want to simply pause the iAd banner in my app. 我只想在应用中暂停iAd横幅。 When the user double clicks the home button to go to the multitasking screen, I made it so the app pauses itself which works perfectly fine. 当用户双击“主页”按钮转到多任务屏幕时,我做到了,因此该应用程序会自行暂停,这非常正常。 But the iAd banner keeps animating itself which looks kind of weird. 但是iAd标语会不断对其进行动画处理,这看起来很奇怪。 A live iAd banner in a frozen app... 冻结的应用中的实时iAd标语...

So how can I programmatically pause an iAd banner ( ADBannerView )? 那么,如何以编程方式暂停iAd标语( ADBannerView )?

Or should I just remove it until the app is in the foreground again? 还是应该将其删除,直到应用再次出现在前台?

Since it's just a UIView, it's probably best to just set it's 'hidden' property to YES in viewWillDisappear (or viewDidDisappear) and then unhide it in viewWillAppear. 因为它只是一个UIView,所以最好在viewWillDisappear(或viewDidDisappear)中将其“ hidden”属性设置为YES,然后在viewWillAppear中将其取消隐藏。

Another approach would be to grab a screencapture of the rectangle representing the banner, overlay an UIImageView on top of the banner and display the screen cap there. 另一种方法是获取代表横幅的矩形的屏幕截图,将UIImageView覆盖在横幅上方,然后在此处显示屏幕截图。 But I think that's a bit overkill. 但是我认为这有点过分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM