1

我在我的应用程序底部显示添加,但在 iOS 7 中,添加从底部显示,但在 iOS 6 中,添加显示在底部。

在此处输入图像描述

-(void)showAdds
{
[bannerView removeFromSuperview];

if ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad))
{
   // bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
    bannerView = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(128.0,
                                           670 ,
                                           GAD_SIZE_728x90.width,
                                           GAD_SIZE_728x90.height)];
    bannerView.adUnitID = @"********";
}
else {
    // Create a view of the standard size at the bottom of the screen.
    //  bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

        bannerView = [[GADBannerView alloc]
                      initWithFrame:CGRectMake(80,
                                               250,
                                               GAD_SIZE_320x50.width,
                                               GAD_SIZE_320x50.height)];
        bannerView.adUnitID = @"*******";
        NSLog(@"ads");
}
bannerView.rootViewController = self;
[self.view addSubview:bannerView];

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

}
4

2 回答 2

3

如果你正在以编程方式进行那么你首先需要为 iOS 6 设置正确的 baneerview 位置,然后检测它的 iOS 6 或 iOs 7 如果它的 iOS 7 那么它的 Y 坐标应该是(iOS 6 中的 Y 坐标)+20 .

您应该添加 20px,因为 iOS 7 将状态栏作为视图控制器内部。

试试这个应该可以的。根据你的回答应该是

    if ([[[UIDevice currentDevice] systemVersion] integerValue] < 7)
    {

     bannerView = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(128.0,
                                           670 ,// Replace it with 650
                                           GAD_SIZE_728x90.width,
                                           GAD_SIZE_728x90.height)];
    bannerView.adUnitID = @"********";
    }
    else
    {
   bannerView = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(128.0,
                                           690 ,// Replace it with 670 if upper value is replaced with 650
                                           GAD_SIZE_728x90.width,
                                           GAD_SIZE_728x90.height)];
    bannerView.adUnitID = @"********";
    }
于 2013-10-22T06:25:17.453 回答
0

我已经做了

if ([[[UIDevice currentDevice] systemVersion] integerValue] < 6)
{

 bannerView = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(128.0,
                                           670 ,
                                           GAD_SIZE_728x90.width,
                                           GAD_SIZE_728x90.height)];
    bannerView.adUnitID = @"********";


}
else

{

 bannerView = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(128.0,
                                           678 ,
                                           GAD_SIZE_728x90.width,
                                           GAD_SIZE_728x90.height)];
    bannerView.adUnitID = @"********";


}
于 2013-10-22T06:17:46.757 回答