Search code examples
iphoneiosxcodeipadrevmob

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


I tried using the suggested code from RevMob to show a banner ad with a specific placement ID without success, tried this code:

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

Tried even to add the following statement

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);
    }

but no success, the only way I could be able to show banner ads was this:

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

But it didn't help to add the placement ID.


Solution

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