Search code examples
iphoneiosframerevmob

Set Revmob banner frame for iphone


I am using Revmob for showing add banner using below code.

[RevMobAds startSessionWithAppID:@"My Application id"];

[RevMobAds session].testingMode = RevMobAdsTestingModeWithAds;

[[RevMobAds session] showBanner];

and it's showing test banner perfectly at the bottom.

Now my question is i want to set this banner at the top of my application.

so how can i set this banner frame ?

I have tried to use RevMobBannerView

My code is

RevMobBannerView *banner = [[RevMobBannerView alloc] initWithFrame:CGRectMake(0, 100, 320, 50)];

[banner setBackgroundColor:[UIColor yellowColor]];

[banner loadAd];

[self.window addSubview:banner];

but it's not working...it's not showing anything into screen.

any help will be apriciated...

Thanks !


Solution

  • In case tkanzakic answer didn't work, you can always use a UIView to put the banner into and add it to your view. In banner load delegate, resize your intermediate view to banner's bounds.

    edit: Something like

    ad = [[[RevMobAds session] bannerView] retain];
    ad.delegate = self;
    [ad loadAd];
    
    - (void)revmobAdDidReceive {
      intermediateView.frame = CGRectMake(0,0, somewidth, someheight);
      ad.frame = intermediateView.bounds;
      [intermediateView addSubview:ad];
    }