【发布时间】:2014-03-16 15:38:39
【问题描述】:
iOS 7 将 iAdAdditions 类别引入 UIViewController。 使用它管理横幅只需一行代码:
self.canDisplayBannerAds = YES;
但我想知道如何检测用户触摸 iAd 横幅。我需要在 iAd 全屏显示时暂停游戏行为(音乐、动画、计时器...)。
我尝试了以下代码:
- (void) viewWillDisappear:(BOOL)animated {
if ([self isPresentingFullScreenAd]) {
// view will disappear because of user action on iAd banner
}
else {
// view will disappear for any other reasons
}
}
- (void) viewWillAppear:(BOOL)animated {
if ([self isPresentingFullScreenAd]) {
// view will appear because full screen iAd — caused by previous user action on iAd banner — is dismissed
}
else {
// view will appear for other reasons
}
}
我做了一些测试,显示一切正常。但是不知道是不是正确的实现方式!
更新
这是我在应用程序的生产版本中使用的解决方案,一切都很好:没有显示任何问题。
【问题讨论】:
标签: ios objective-c touch iad banner