Search code examples
iosrevmob

How to change the position of Rev Mob Banner Ad in an iOS app?


Integrated the Rev Mob banner type Ad with my iOS app.It was successfully displayed the Ads of banner type. But I want to change the banner position to top of the screen.How can I change the position of banner type Ad to top? For displaying the banner type Ad I used the following code,

 [[RevMobAds session] showBanner];

Solution

  • You can always use a UIView to put the banner into. In banner load delegate, resize your intermediate view to banner's bounds.

    In your ViewDidLoad Declare :-

    ad = [[[RevMobAds session] bannerView] retain];
    ad.delegate = self;
    [ad loadAd];
    

    Then add a method

    - (void)revmobAdDidReceive {
      intermediateView.frame = CGRectMake(0,0, somewidth, someheight);
      ad.frame = intermediateView.bounds;
      [intermediateView addSubview:ad];
    }
    

    Or simply set the frame accordingly.

    RevMobBannerView *ad = [[RevMobAds session] bannerView];
    ad.delegate = self;
    [ad loadAd];
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
      ad.frame = CGRectMake(0, 0, 768, 114);
    } else {
      ad.frame = CGRectMake(0, 0, 320, 50);
    }
    
    [self.view addSubView:ad];