广告横幅移出位置,显示故障

时间:2015-12-10 19:52:54

标签: swift sprite-kit iad adbannerview

我的游戏中有一个AdBannerView,但它会随机显示,即使我将其设置为隐藏,它会从底部弹出视图。

这是我到目前为止在GameScene中的代码:

with open("OriginalTextFile.txt", 'r') as SearchList:
    for line in SearchList:
        line_text = str(line)
        try:
            test_query = re.search('start (.+?) end', line_text).group(1)
            print test_query # confirms that I AM getting the correct test_query
            if str(test_query) in load_workbook('Subset.xlsx', read_only=True):
                print 'FOUND IT IN SUBSET!'

                 ----- Continues -----

有时广告会在游戏过程中显示,有时会显示在顶部,有时会显示在底部。

我的问题是:

  1. 如何将其置于顶部?
  2. 我如何制作它以便在游戏过程中停止显示?
  3. 如何让它停止推动视图?
  4. 如何加载(目前确实显示)
  5. ,如何停止显示

    更多信息:我在ViewController中尝试了此代码,但结果却相同。

2 个答案:

答案 0 :(得分:1)

问题1:您已设置框架属性以定位横幅广告:

iAd.frame = CGRectMake(0, view.frame.size.height - iAd.frame.size.height, view.frame.size.width, iAd.frame.size.height);

答案 1 :(得分:1)

听起来您已经在Interface Builder中创建了ADBannerView,除了在项目的某处包含self.canDisplayBannerAds

设备屏幕底部显示的ADBannerViewself.canDisplayBannerAds = true创建。 self.canDisplayBannerAds = true可用于在应用程序中实现iAd横幅的无麻烦方式。这将为您创建ADBannerView,并根据其是否从iAd网络收到广告来显示或隐藏ADBannerView

如果您在项目中添加了self.canDisplayBannerAds = true,则需要将其删除。

至于在ADBannerView收到广告时隐藏ADBannerView,您需要实施bannerView(_:didFailToReceiveAdWithError:)的委托方法:ADBannerViewDelegate Protocol Reference。然后,在ADBannerView中,您将alpha 0媒体资源设置为$em = $this->getDoctrine()->getManager(); //$cars is taken from the entity and is not null foreach($cars as $car) { $car->setHasContent('yes'); $em->persist($car); $em->flush(); }

相关问题