1

我已经在我的应用程序中实施了亚马逊广告,但问题是当我在 iPhone 6 和 iPhone 6+ 上运行应用程序时,宽度没有根据设备设置。

这是我的代码:

self.amazonAdView = [AmazonAdView amazonAdViewWithAdSize:AmazonAdSize_320x50];

   options = [AmazonAdOptions options];

    // Turn on isTestRequest to load a test ad

    options.isTestRequest = YES;

    // Register the ViewController with the delegate to receive callbacks.
    self.amazonAdView.delegate = self;

    // Load an ad
    [self.amazonAdView loadAd:options];



    // Adjust the ad position on iOS 7 devices due to the new status bar behavior on apps built with iOS 7 SDK
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
    if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending) {
        self.amazonAdView.frame = CGRectMake(0, 20, self.amazonAdView.frame.size.width, self.amazonAdView.frame.size.height);
    }
#endif

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

    [self.view addSubview:self.amazonAdView];

我已经参考了此链接以了解广告尺寸,该链接说亚马逊文档广告尺寸特定。

以下是我运行应用程序时的输出。我想要根据设备尺寸的全宽广告。

在此处输入图像描述

我已经尝试过以下代码但不起作用;

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

请帮我设置亚马逊广告尺寸。

帮助将不胜感激。

4

0 回答 0