Revmob横幅广告位置 - 斯威夫特

时间:2016-03-25 18:31:15

标签: ios swift sprite-kit revmob

我有以下代码来初始化和加载Revmob横幅广告。我尝试指定广告的位置,因为默认情况下它会在底部加载,我需要它位于屏幕的顶部。但是,此代码似乎不起作用,我的广告无法加载。我在viewDidLoad()下的GameViewController类中实现了这个。

    let banner = RevMobBannerView()
    banner.loadAd()
    banner.frame = CGRectMake(0,0,320,50)

    let completionBlock: () -> Void = {
        banner.showAd()
        self.view.addSubview(banner)
    }

    let errorBlock: (NSError!) -> Void = {error in
        print (error);
    }

    RevMobAds.startSessionWithAppID("56b691a64756d5655fdf097e", withSuccessHandler: completionBlock, andFailHandler: errorBlock);

1 个答案:

答案 0 :(得分:0)

我在创建框架或子视图后移动了.loadAd(),这可能有用吗?:

let banner = RevMobBannerView()
    banner.frame = CGRectMake(0,0,320,50)
    banner.loadAd()

    let completionBlock: () -> Void = {
        self.view.addSubview(banner)
        banner.showAd()
    }

    let errorBlock: (NSError!) -> Void = {error in
        print (error);
    }

    RevMobAds.startSessionWithAppID("56b691a64756d5655fdf097e", withSuccessHandler: completionBlock, andFailHandler: errorBlock);