How to initiate revmob banner ad with exact frame and placement ID?

半城伤御伤魂 提交于 2019-12-03 22:14:07
XIII

I think you need to do it as the following by using the RevMobBannwerView instead:

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];

When I'm adding it(RevMob version 5.9) in my project. I do it like this:

[RevMobAds startSessionWithAppID:@"my id"];
RevMobBannerView *ad = [[RevMobAds session] bannerView]; // you must retain this object
[ad loadWithSuccessHandler:^(RevMobBannerView *banner) {
    banner.frame = CGRectMake(0, 381, 320, 50);
    [self.window.rootViewController.view addSubview:banner];
    NSLog(@"Ad loaded");
} andLoadFailHandler:^(RevMobBannerView *banner, NSError *error) {
    NSLog(@"Ad error: %@",error);
} onClickHandler:^(RevMobBannerView *banner) {
    NSLog(@"Ad clicked");
}];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!