My admob banner is at the top

I have an admob banner in my application, and I implemented it using the AdMob documentation, the only error of which is that it does not appear at the bottom of the screen, but at the top. Now I have been looking for a long time, But I can not find how to change it, and I can not find anyone on the network, solving this problem.

Does anyone know how to fix this?

thanks

EDIT

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

I looked for numbers on all admob scripts, but could not find them for editing ..

+6
source share
3 answers

Have you tried changing the view frame (GADBannerView, I think?) To place it at the bottom, not the top?

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


change

All you have 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 - CGSizeFromGADAdSize(kGADAdSizeBanner).height); // Use predefined GADAdSize constants to define the GADBannerView. bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin]; 
+15
source
 CGFloat height = [UIScreen mainScreen].bounds.size.height; bannerView_=[[GADBannerView alloc] initWithAdSize:(kGADAdSizeBanner) origin:CGPointMake(0,height-kGADAdSizeBanner.size.height)]; 
+2
source
 CGPoint origin = CGPointMake(0.0,bannerHeight); self.addBanner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait origin:origin]; 

for all iphones and iPads

0
source

Source: https://habr.com/ru/post/919458/


All Articles