【发布时间】:2015-01-02 18:50:48
【问题描述】:
我目前正在使用 SpriteKit 并尝试将 iAd 整合到其中。从我所见,似乎最好的办法是将它放在 UIViewController 的子类中,因为您无法将 AdBannerView 添加到 Sk 场景中。但是,我不知道如何将 UIViewContoller 类添加到我的 SKScene。
我的 UIViewController 的 Ads 类包含:
iAdSupported = iAdTimeZoneSupported()
bannerDisplayed = false
if iAdSupported {
iAdView = ADBannerView(adType: ADAdType.Banner)
iAdView?.frame = CGRectMake(0, 0 - iAdView!.frame.height, iAdView!.frame.width, iAdView!.frame.height)
iAdView?.delegate = self
self.view.addSubview(iAdView!)
}
该类通过并调试,就像它已添加到视图中一样,但在 SKScene 顶部不可见。 要调用我调用的广告类:
var AdsController: Ads!
AdsController = Ads()
AdsController.setupAds()
我还在 SKScene 中尝试过以下操作:
var currentViewController:UIViewController=UIApplication.sharedApplication().keyWindow.rootViewController!
currentViewController.presentViewController(Ads, animated: true, completion: nil)`
我已经查看了大量关于此的页面,但似乎无法快速找到解决此问题的任何内容。
任何帮助都会很棒,非常感谢!
尼克
【问题讨论】:
标签: ios swift uiviewcontroller sprite-kit adbannerview