我想在屏幕底部显示 iAd.. 我试图添加 subView 但 iAd 显示在一个单元格中,他隐藏了他。
我应该怎么做才能使 tableView 在 iAd 下滚动?
我的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
[self createAdBannerView];
[self.view addSubview:self.adBannerView];
}
#pragma mark - ADBannerViewDelegate
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
[self adjustBannerView];
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
[self adjustBannerView];
}
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
return YES;
}
- (void)bannerViewActionDidFinish:(ADBannerView *)banner
{
}
- (void) adjustBannerView
{
CGRect contentViewFrame = self.view.bounds;
CGRect adBannerFrame = self.adBannerView.frame;
if([self.adBannerView isBannerLoaded])
{
CGSize bannerSize = [ADBannerView sizeFromBannerContentSizeIdentifier:self.adBannerView.currentContentSizeIdentifier];
contentViewFrame.size.height = contentViewFrame.size.height - bannerSize.height;
adBannerFrame.origin.y = contentViewFrame.size.height;
}
else
{
adBannerFrame.origin.y = contentViewFrame.size.height;
}
[UIView animateWithDuration:0.5 animations:^{
self.adBannerView.frame = adBannerFrame;
self.contentView.frame = contentViewFrame;
}];
}
- (void) createAdBannerView
{
self.adBannerView = [[ADBannerView alloc] initWithFrame:CGRectZero];
CGRect bannerFrame = self.adBannerView.frame;
bannerFrame.origin.y = self.view.frame.size.height;
self.adBannerView.frame = bannerFrame;
self.adBannerView.delegate = self;
self.adBannerView.requiredContentSizeIdentifiers = [NSSet setWithObjects:ADBannerContentSizeIdentifierPortrait, ADBannerContentSizeIdentifierLandscape, nil];
}
编辑:
我该如何防止这种情况?我想把 iAd 放在底部..
提前致谢!