David26th
David26th

Reputation: 401

Changing Position of Admob BannerView on iOS

I've got my AdMob banners all setup and working but I'm having some trouble positioning them.

This is the code that's in presently to load the bannerview, but I can't quite place how to move it (let's assume to a position of 100, 100)

Can anyone help?

Regards David

  bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeFullBanner];
bannerView_.adUnitID = @"a14ff98b8ab890d";
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
  [bannerView_ loadRequest:[GADRequest request]];

Upvotes: 0

Views: 4888

Answers (2)

Sawsan
Sawsan

Reputation: 1114

You can add origin to your bannerView_

CGPoint origin = CGPointMake(0.0, 0.0); //Update the X and Y origin to what you need, ex: (0.0, 204.0)
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin];

Upvotes: 2

coneybeare
coneybeare

Reputation: 33101

[bannerView_ setFrame:CGRectMake(100,
                                 100,
                                 bannerView_.bounds.size.width,            
                                 bannerView_.bounds.size.height)];

Upvotes: 4

Related Questions