iAD尺寸是风景画像

时间:2015-08-20 00:22:28

标签: ios iad

我想在屏幕底部实现iAd。我的应用程序仅在横向模式下运行,但iAd处于纵向模式,它太大了,我希望它正确。

我用它实例化它:

ADBannerView * adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0,self.view.frame.size.height - 50,480,32)];

[self.view addSubview:adView];

所以我给它480 x 32但它是360x 50。

这对我没有意义,我也不知道该怎么做。在我读到的另一个主题中,我必须禁用自动布局,但它已禁用。

感谢您的帮助!

编辑:即使我通过故事板将iAd添加到横向格式的视图中,它也会在我运行应用程序时以纵向格式显示。

编辑:我想我没有ADBannerView Appdelegate方法。 我对iAd的全部内容是: GameViewcontroller.h

@interface GameViewController : UIViewController<ADBannerViewDelegate>

GameViewcontroller.m

@interface GameViewController ()
{
BOOL _bannerIsVisible;
ADBannerView *_adBanner;
}
-(void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    _adBanner = [[ADBannerView alloc]      initWithFrame:CGRectMake((self.view.frame.size.width /2) - 180,       self.view.frame.size.height, 480, 32)];
_adBanner.delegate = self;
[self.view addSubview:_adBanner];

}

 - (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
if (!_bannerIsVisible)
{
    // If banner isn't part of view hierarchy, add it
    if (_adBanner.superview == nil)
    {
        [self.view addSubview:_adBanner];
    }

    [UIView beginAnimations:@"animateAdBannerOn" context:NULL];

    // Assumes the banner view is just off the bottom of the screen.
    banner.frame = CGRectOffset(banner.frame, 0, -  banner.frame.size.height);

    [UIView commitAnimations];

    _bannerIsVisible = YES;
}

}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:    (NSError *)error
{
NSLog(@"Failed to retrieve ad");

if (_bannerIsVisible)
{
    [UIView beginAnimations:@"animateAdBannerOff" context:NULL];

    // Assumes the banner view is placed at the bottom of the screen.
    banner.frame = CGRectOffset(banner.frame, 0,  banner.frame.size.height);

    [UIView commitAnimations];

    _bannerIsVisible = NO;
}

}

0 个答案:

没有答案