IAd 横幅将整个 skscene 向上移动

IAd banner moves entire skscene upwards

我在我的 spritekit 游戏中放置了一个广告横幅,当广告出现时,横幅将整个屏幕向上推。我尝试更改横幅的 zposition,但没有任何效果。

 @IBOutlet weak var adBanner: ADBannerView!
    override func viewDidLoad() {

        super.viewDidLoad()
        let scene = GameScene(size: view.bounds.size)
        let skview = view as! SKView
        scene.scaleMode = .AspectFill
        if #available(iOS 8.0, *) {
          //  skview.showsPhysics = true
        } else {
            // Fallback on earlier versions
        }
        self.canDisplayBannerAds = true
        self.adBanner?.delegate = self
        self.adBanner?.hidden = true


        //adBannerView?.hidden = true
        skview.presentScene(scene)
    }
    func bannerViewWillLoadAd(banner: ADBannerView!) {
        self.adBanner?.hidden = false
    }
    func bannerViewDidLoadAd(banner: ADBannerView!) {
        self.adBanner.layer.zPosition = 2
    }
    func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
        return true
    }

    func bannerViewActionDidFinish(banner: ADBannerView!) {
        self.adBanner?.hidden = true
    }

您有两个 iAd 横幅。一个是您使用 self.canDisplayBannerAds = true 创建的,一个是您在 Interface Builder 中创建的。删除 self.canDisplayBannerAds = true.