Set Admob banner to appear at bottom of screen

后端 未结 2 824
抹茶落季
抹茶落季 2020-12-20 05:57

I am currently using this code to display an Admob request;

If I use this code, the banner appears, but at the top of the screen not the bottom;

CGRe         


        
2条回答
  •  攒了一身酷
    2020-12-20 06:27

    You can check the solution proposed in Google Ads developer blog: http://googleadsdeveloper.blogspot.com/2012/06/keeping-smart-banner-docked-to-bottom.html

    // Initialize the banner docked to the bottom of the screen.
    // We start in a portrait orientation so use kGADAdSizeSmartBannerPortrait.
      CGPoint origin = CGPointMake(0.0,
                                   self.view.frame.size.height -
                                   CGSizeFromGADAdSize(
                                       kGADAdSizeSmartBannerPortrait).height);
    
      self.adBanner = [[[GADBannerView alloc]
                        initWithAdSize:kGADAdSizeSmartBannerPortrait
                                origin:origin] autorelease];
    
    //Continue rest of initialization here
    

    Make sure to use self.view.frame.size.width in the Y coordinate of the origin if you are using kGADAdSizeSmartBannerLandscape.

提交回复
热议问题