Admob大横幅位置

时间:2017-01-24 05:01:03

标签: objective-c xcode admob

我试图使用大横幅而不是智能横幅,但我无法让它保持在最底层。我将此代码用于智能横幅,它保留在底部但不适用于大横幅广告。当我从kGADAdSizeSmartBannerPortrait更改为kGADAdSizeLargeBanner时,横幅移到顶部。

     _bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];

    _bannerView_.frame = CGRectMake(0, self.view.frame.size.height - _bannerView_.frame.size.height , self.view.frame.size.width, _bannerView_.frame.size.height);

1 个答案:

答案 0 :(得分:0)

您可以尝试使用此代码。

// 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);

  _bannerView_ = [[[GADBannerView alloc]
                    initWithAdSize:kGADAdSizeSmartBannerPortrait
                            origin:origin] autorelease];

//Continue rest of initialization here

参考:http://googleadsdeveloper.blogspot.in/2012/06/keeping-smart-banner-docked-to-bottom.html