,所以我使用教程在屏幕底部创建IAD横幅并将其动画到窗口中,但是该应用程序是基于选项卡的,我不太了解知道正确的偏移,所以您可以告诉我,我会很感激,但是主要问题是Adbanner并不总是出现,有时它只是一个白盒。这是我的代码。在我的.h
中@interface section3 <ADBannerViewDelegate>{
ADBannerView *adView;
BOOL bannerIsVisible;
}
@property (nonatomic, assign) BOOL bannerIsVisible;
//in the .m in the view did load
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0.0, 410.0f);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
adView.delegate = self;
self.bannerIsVisible = NO;
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
if (!self.bannerIsVisible) {
[UIView beginAnimations:@"animateAdBannerOn" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0.0, -50.0f);
[UIView commitAnimations];
self.bannerIsVisible = YES;
}
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
if (self.bannerIsVisible) {
[UIView beginAnimations:@"animateAdBannerOff" context:NULL];
banner.frame = CGRectOffset(banner.frame, 0.0, 50.0f);
[UIView commitAnimations];
self.bannerIsVisible = NO;
}
}
我正在使用Xcode 4.2.1非常感谢您,任何帮助都将不胜感激:)
TABBAR高44px,因此您必须添加到" 50" 44之一,并将410的全屏尺寸达到3.5英寸的3.5英寸均值为480默认值。那应该是解决方案。