从顶部加载iAd横幅

时间:2014-06-26 20:33:14

标签: ios objective-c iad adbannerview

我已经设法将iAd实施到我的应用程序中,横幅从底部加载,我不确定如何从顶部加载它。我已经尝试了很多东西,但我似乎无法破解它。有人可以帮忙吗?

我的代码:

- (void)layoutAnimated:(BOOL)animated
{
    CGRect contentFrame = self.view.bounds;

    CGRect bannerFrame = self.bannerView.frame;
    if (self.bannerView.bannerLoaded) {
        contentFrame.size.height -= self.bannerView.frame.size.height;
        bannerFrame.origin.y = contentFrame.size.height;
    } else {
        bannerFrame.origin.y = contentFrame.size.height;
    }

    [UIView animateWithDuration:animated ? 0.25 : 0.0 animations:^{
        self.contentView.frame = contentFrame;
        [self.contentView layoutIfNeeded];
        self.bannerView.frame = bannerFrame;
    }];
}

0 个答案:

没有答案