iphone - 如何使用准确的框架和展示位置 ID 启动 revmob 横幅广告?

标签 iphone ios xcode ipad revmob

我尝试使用 RevMob 建议的代码来展示带有特定展示位置 ID 的横幅广告,但没有成功,尝试了以下代码:

RevMobAds *revmob = [RevMobAds revMobAds];
        RevMobBanner *banner = [revmob bannerWithPlacementId:@"ID_FROM_REV_MOB"];
        [banner showAd];

甚至尝试添加以下语句

if (IS_iPad) {
        banner.frame =  CGRectMake(0, 958, 768, 66);
    } else if (IS_WIDESCREEN){
        banner.frame = CGRectMake(0, 518, 320, 50);
    } else {
        banner.frame = CGRectMake(0, 430, 320, 50);
    }

但没有成功,我能够显示横幅广告的唯一方法是:

[RevMobAds showBannerAdWithFrame:CGRectMake(0, 958, 768, 66) withDelegate:self];

但添加展示位置 ID 没有帮助。

最佳答案

我认为您需要使用 RevMobBannwerView 来执行以下操作:

RevMobAds *revmob = [RevMobAds revMobAds];
        RevMobBannerView *revBannerView = [revmob bannerViewWithPlacementId:@"ID_FROM_REV_MOB"];
        if (IS_iPad) {
            revBannerView.frame =  CGRectMake(0, 958, 768, 66);
        } else if (IS_WIDESCREEN){
            revBannerView.frame = CGRectMake(0, 518, 320, 50);
        } else {
            revBannerView.frame = CGRectMake(0, 430, 320, 50);
        }
        [revBannerView loadAd];
        [self.view addSubview:revBannerView];
        [self.view bringSubviewToFront:revBannerView];

关于iphone - 如何使用准确的框架和展示位置 ID 启动 revmob 横幅广告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13068356/

相关文章:

iphone - 错误 : This class is not key value coding-compliant for the key keyPath

iphone - 核心图折线图 : Add padding to the right of the graph

导航 Controller 转换上的 iOS 黑线

iphone - 通过在iPhone中命名约定来加载高分辨率图像的逻辑

ios - CSS 未在 iOS 应用中应用

ios - AVAudioEngine.connect 上的 CoreAudio 错误和崩溃

iphone - 多个按钮的弧 : Setting references to nil,

ios - UICollectionViewCell 并排

ios - 如何解释 Fabric 崩溃和 Xcode 崩溃之间的巨大差异?

ios - iOS中UITableView的自定义设计