Kevin Kevin - 5 months ago 44
Objective-C Question

my admob banner shows in top

I have a admob banner in my app and I've implemented it with the documentation AdMob provided, the only thing wrong with it is that it does not show at the bottom of the screen but in the top instead. Now I've been looking for a long time But I can't find how to change it and I can't find anyone one the net solving this problem.

Someone knows how to fix this?



// Create a view of the standard size at the bottom of the screen.
// Available AdSize constants are explained in GADAdSize.h.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"MYID";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];

been looking for numbers on all the admob scripts but Can't find any to edit..


Have you tried changing the frame of the view (GADBannerView I think?) to position it at the bottom instead of the top?

Here's an example (you should replace the placeholders with the correct attributes: bannerView.frame = CGRectMake(0.0, 460 - bannerheight, bannerwidth, bannerheight);


All you need to do is replace this:

bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

With all of this:

// Initialize the banner at the bottom of the screen.
CGPoint origin = CGPointMake(0.0,
                               self.view.frame.size.height + 20 -

// Use predefined GADAdSize constants to define the GADBannerView.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner