Question

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];
Was it helpful?

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

OTHER TIPS

From their documentation (and it works well for me) :

RevMobBannerView *banner = [[RevMobAds session] bannerView];
banner.delegate = self;

[banner loadWithSuccessHandler:^(RevMobBannerView *banner) {
   [banner setFrame:CGRectMake(10, 20, 200, 40)];
   [self.view addSubview:banner];
   NSLog(@"Ad loaded");
 } andLoadFailHandler:^(RevMobBannerView *banner, NSError *error) {
   NSLog(@"Ad error: %@",error);
 } onClickHandler:^(RevMobBannerView *banner) {
   NSLog(@"Ad clicked");
 }];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top